From 89709d0a3baf834d9cdbb6d5d1cfaf751e1e0463 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 18 Apr 2022 20:56:41 +0200 Subject: [PATCH] Add tests tab stub --- src/Carp/CarpModule.class.st | 61 ++++++++++++++++++- src/Carp/CarpModuleCoderElement.class.st | 4 ++ .../CarpStreamingMethodsCoderElement.class.st | 5 ++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/Carp/CarpModule.class.st b/src/Carp/CarpModule.class.st index a4260c5..3faf188 100644 --- a/src/Carp/CarpModule.class.st +++ b/src/Carp/CarpModule.class.st @@ -37,7 +37,7 @@ CarpModule >> carpCoderCommentsFor: aView [ ^ aView explicit title: 'Documentation'; tooltip: 'Module Documentation'; - priority: 30; + priority: 1; disableAsync; stencil: [ | snippet snippetViewModel | @@ -118,6 +118,60 @@ CarpModule >> carpCoderStreamingMethodsFor: aView context: aPhlowContext [ stencil: [ CarpStreamingMethodsCoderElement forModule: self ] ] +{ #category : #coders } +CarpModule >> carpCoderStreamingTestsFor: aView context: aPhlowContext [ + + | aMethodsCoder aMethodsCoderViewModel aNewMethodCoderHolder | + + aNewMethodCoderHolder := ValueHolder new. + + ^ aView explicit + priority: 10; + title: 'Tests'; + disableAsync; + actionDropdownButtonDo: [ :aDrodownAction | + aDrodownAction dropdown + icon: BrGlamorousVectorIcons add; + tooltip: 'Add new test suite'; + content: [ :aButton | + | aNewMethodCoder aNewMethodCoderViewModel aHandler | + + aNewMethodCoderHolder contents + ifNotNil: [ :aContents | + aNewMethodCoderViewModel := aContents ] + ifNil: [ + + aNewMethodCoder := GtCarpCoderModel new. + + aNewMethodCoderViewModel := aNewMethodCoder asCoderViewModel. + aNewMethodCoderViewModel + withoutHeader; + expanded: true; + focused: true; + moveCursorAtEnd. + + aNewMethodCoderHolder contents: aNewMethodCoderViewModel. + + aHandler := GtPharoNewMethodCodeSavedHandler new + methodsCoderViewModel: aMethodsCoderViewModel; + element: aButton; + methodCoderHolder: aNewMethodCoderHolder. + + aNewMethodCoderViewModel weak + when: GtMethodCoderSaved + send: #onAnnouncement: + to: aHandler ]. + + (GtExpandedOnlyCoderElement new coderViewModel: aNewMethodCoderViewModel) + hExact: 300; + vFitContent; + background: Color white; + padding: (BlInsets all: 5); + addAptitude: BrGlamorousFocusableShadowAptitude new ]; + name: #'button--add-new-test-suite']; + stencil: [ (CarpStreamingMethodsCoderElement forModule: self) onTests ] +] + { #category : #accessing } CarpModule >> expressions [ ^ expressions @@ -150,6 +204,11 @@ CarpModule >> setUses: aCollectionOfStrings [ uses := aCollectionOfStrings asSet ] +{ #category : #accessing } +CarpModule >> tests [ + ^ tests +] + { #category : #converting } CarpModule >> toCarp [ diff --git a/src/Carp/CarpModuleCoderElement.class.st b/src/Carp/CarpModuleCoderElement.class.st index 3c7a236..ad86f76 100644 --- a/src/Carp/CarpModuleCoderElement.class.st +++ b/src/Carp/CarpModuleCoderElement.class.st @@ -79,6 +79,10 @@ CarpModuleCoderElement >> buildModuleLabel [ aContainer addChild: aModuleNameEditor. + aContainer addChild: (BrFrame new + vFitContent; + hMatchParent). + aContainer addChild: (BrButton new aptitude: BrGlamorousButtonWithIconAptitude; icon: BrGlamorousVectorIcons play; diff --git a/src/Carp/CarpStreamingMethodsCoderElement.class.st b/src/Carp/CarpStreamingMethodsCoderElement.class.st index 0d0b308..67e5433 100644 --- a/src/Carp/CarpStreamingMethodsCoderElement.class.st +++ b/src/Carp/CarpStreamingMethodsCoderElement.class.st @@ -43,3 +43,8 @@ CarpStreamingMethodsCoderElement >> module: aModule [ module := aModule. self initializeForModule ] + +{ #category : #accessing } +CarpStreamingMethodsCoderElement >> onTests [ + list itemsProvider: module tests asBrItemsProvider +]