Skip to content

Commit

Permalink
added test of transcript saveAs* menu items enablement
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Winger authored and Eric Winger committed Dec 15, 2022
1 parent ed2eeb4 commit 6253663
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
13 changes: 11 additions & 2 deletions sources/JadeiteTranscript.cls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Filed out from Dolphin Smallalk"!

JadeTranscript subclass: #JadeiteTranscript
instanceVariableNames: 'projectListPresenter isTranscriptInstalled autoCommit areBreakpointsEnabled autoCompleteEnabled transactionModePresenter lastKnownTransaction'
instanceVariableNames: 'projectListPresenter isTranscriptInstalled autoCommit areBreakpointsEnabled autoCompleteEnabled transactionModePresenter lastKnownTransaction cardContainer'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Expand Down Expand Up @@ -93,6 +93,12 @@ browseMethodsContaining
browseSendersOf
^JadePresenter browseSendersIn: self gciSession!

cardContainer
^cardContainer!

cardContainer: anObject
cardContainer := anObject!

committedTransaction
self displayLastKnownCommitOrAbort!

Expand All @@ -105,7 +111,8 @@ createComponents
lastKnownTransaction := self add: TextPresenter new name: 'lastKnownTransaction'.
lastKnownTransaction value: 'Last Known Commit or Abort: (unknown)'.
transactionModePresenter := self add: RadioButtonSetPresenter new name: 'transactionMode'.
transactionModePresenter model: (self aspectValue: #transactionMode)!
transactionModePresenter model: (self aspectValue: #transactionMode).
cardContainer := self add: Presenter new name: 'cardContainer'. "for testing"!

createNewProject
^projectListPresenter createNewProject!
Expand Down Expand Up @@ -493,6 +500,8 @@ browseJadeitePrefs!menu handlers!public! !
browseLiteralReferences!menu handlers!public! !
browseMethodsContaining!menu handlers!public! !
browseSendersOf!menu handlers!public! !
cardContainer!accessing!private! !
cardContainer:!accessing!private! !
committedTransaction!event handling!public! !
commitTransaction!menu handlers!public! !
createComponents!initialization!public! !
Expand Down
65 changes: 64 additions & 1 deletion sources/JadeiteTranscriptTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ test_jadeiteMenuAdHocExecutionItems
self assert: displayMenuItem commandDescription acceleratorKey = 4676 "Ctrl-D"!

test_menuBarBrowseProjectsHonorsSelection
| randomIndex projectPresenter projectName browseMenu browseProjectsMenuItem projectsPresenter |
| randomIndex projectName browseMenu browseProjectsMenuItem projectsPresenter |
randomIndex := (Random new next * 4) ceiling.
transcript projectListPresenter projectListPresenter selectionByIndex: randomIndex.
projectName := transcript projectListPresenter projectListPresenter selection name.
Expand Down Expand Up @@ -643,6 +643,68 @@ test_menuNames
self assert: checkoutMenuItem command equals: #checkout.
self assert: (transcript projectListPresenter class canUnderstand: #checkout)!

test_menuSaveOnlyEnabledOnWorkspace
| fileMenu fileSaveItem fileSaveQuery fileSaveAsItem fileSaveAsQuery |
self testsIssue: #issue953 withTitle: 'File Browser for server files'.
fileMenu := transcript view menuBar items detect: [:menu | '*File*' match: menu text] ifNone: [].
fileSaveItem := fileMenu items detect: [:command | command command = #fileSave] ifNone: [].
fileSaveQuery := CommandQuery commandDescription: fileSaveItem commandDescription
source: transcript view.
fileSaveAsItem := fileMenu items detect: [:command | command command = #fileSaveAs] ifNone: [].
fileSaveAsQuery := CommandQuery commandDescription: fileSaveAsItem commandDescription
source: transcript view.
transcript cardContainer view cardLayout firstCard.
self assert: transcript cardContainer view currentCard name = 'Transcript'.
transcript queryCommand: fileSaveQuery.
self deny: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self deny: fileSaveAsQuery isEnabled.

transcript cardContainer view cardLayout nextCard.
self assert: transcript cardContainer view currentCard name = 'history'.
transcript queryCommand: fileSaveQuery.
self deny: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self deny: fileSaveAsQuery isEnabled.

transcript cardContainer view cardLayout nextCard.
self assert: transcript cardContainer view currentCard name = 'Stone'.
transcript queryCommand: fileSaveQuery.
self deny: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self deny: fileSaveAsQuery isEnabled.

transcript cardContainer view cardLayout nextCard.
self assert: transcript cardContainer view currentCard name = 'My Session'.
transcript queryCommand: fileSaveQuery.
self deny: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self deny: fileSaveAsQuery isEnabled.

transcript cardContainer view cardLayout nextCard.
self assert: transcript cardContainer view currentCard name = 'All Sessions'.
transcript queryCommand: fileSaveQuery.
self deny: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self deny: fileSaveAsQuery isEnabled.

transcript cardContainer view cardLayout nextCard.
self assert: transcript cardContainer view currentCard name = 'codePane'.
transcript queryCommand: fileSaveQuery.
self assert: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self assert: fileSaveAsQuery isEnabled.

transcript cardContainer view cardLayout nextCard.
self assert: transcript cardContainer view currentCard name = 'projectsList'.
transcript queryCommand: fileSaveQuery.
self deny: fileSaveQuery isEnabled.
transcript queryCommand: fileSaveAsQuery.
self deny: fileSaveAsQuery isEnabled.


!

test_multiSelectProject
| projectServices projectCount |
self testsIssue: #issue163
Expand Down Expand Up @@ -959,6 +1021,7 @@ test_implementorsSendersSearchList!public!tests! !
test_jadeiteMenuAdHocExecutionItems!public!test menus! !
test_menuBarBrowseProjectsHonorsSelection!public!tests! !
test_menuNames!public!tests! !
test_menuSaveOnlyEnabledOnWorkspace!public!test menus! !
test_multiSelectProject!public!tests! !
test_openChangesBrowser!public!tests! !
test_openPreferencesFile!public!tests! !
Expand Down
2 changes: 1 addition & 1 deletion sources/Rowan UI Base.pax
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ JadeWorkspace subclass: #JadeiteServerFileWorkspace
poolDictionaries: ''
classInstanceVariableNames: ''!
JadeTranscript subclass: #JadeiteTranscript
instanceVariableNames: 'projectListPresenter isTranscriptInstalled autoCommit areBreakpointsEnabled autoCompleteEnabled transactionModePresenter lastKnownTransaction'
instanceVariableNames: 'projectListPresenter isTranscriptInstalled autoCommit areBreakpointsEnabled autoCompleteEnabled transactionModePresenter lastKnownTransaction cardContainer'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Expand Down

0 comments on commit 6253663

Please sign in to comment.