Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Backend-independant interactions.
Remove widgets as they are already present in Spec.
  • Loading branch information
demarey committed Jun 14, 2024
1 parent eac293f commit 45c9078
Show file tree
Hide file tree
Showing 25 changed files with 293 additions and 1,318 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
smalltalk: [ Pharo64-9.0 , Pharo64-8.0 ]
smalltalk: [ Pharo64-12.0 , Pharo64-alpha ]
name: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.smalltalk }}
Expand Down
6 changes: 4 additions & 2 deletions src/BaselineOfInteractions/BaselineOfInteractions.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ BaselineOfInteractions >> baseline: spec [
<baseline>
spec
package: 'Interactions';
package: 'Interactions-Widgets';
package: 'Interactions-Widgets-Tests'
package: 'Interactions-Widgets'
with: [ spec requires: #( 'Interactions' ) ];
package: 'Interactions-Tests'
with: [ spec requires: #( 'Interactions' 'Interactions-Widgets' ) ]
]
120 changes: 120 additions & 0 deletions src/Interactions-Tests/SpecInteractionTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Class {
#name : 'SpecInteractionTest',
#superclass : 'TestCase',
#instVars : [
'backend',
'widget'
],
#category : 'Interactions-Tests',
#package : 'Interactions-Tests'
}

{ #category : 'running' }
SpecInteractionTest >> setUp [
super setUp.

backend := SpecInteraction default
]

{ #category : 'running' }
SpecInteractionTest >> tearDown [
widget ifNotNil: [ :w | w delete ].
super tearDown
]

{ #category : 'tests' }
SpecInteractionTest >> testCanOpenAConfirmation [

| confirm window |
confirm := ITConfirmation new
title: 'Remove File';
message: 'Are you sure you want to delete this file?';
yesLabel: 'delete'.

widget := backend for: confirm.
widget doInteraction.

window := widget window.
self assert: window title equals: confirm title.
self assert: widget label equals: confirm message.
self assertCollection: (window buttons collect: #label) hasSameElements: #('no' 'delete')
]

{ #category : 'tests' }
SpecInteractionTest >> testCanOpenAFileRequest [

| fileRequest window |
fileRequest := ITFileRequest new
title: 'Image file to open?';
filter: '.image';
currentFolder: FileLocator home.

widget := backend for: fileRequest.
widget doInteraction.

window := widget window.
self assert: window title equals: fileRequest title.
self assert: widget fileNavigationSystem filtersDropList selectedItem basename equals: '.image'.
self assert: widget fileNavigationSystem currentDirectory equals: FileLocator home.
]

{ #category : 'tests' }
SpecInteractionTest >> testCanOpenAnInformation [

| inform window |
inform := ITInformation new
title: 'Some confirmation needed';
message: 'Do you want to proceed?'.

widget := backend for: inform.
widget doInteraction.

window := widget window.
self assert: window title equals: inform title.
self assert: widget label equals: inform message.
self assertCollection: (window buttons collect: #label) hasSameElements: #('Ok')
]

{ #category : 'tests' }
SpecInteractionTest >> testCanSelectAFile [

| fileRequest fs file bImage |
fs := FileSystem memory.
(fs root / 'a.image') ensureCreateFile.
bImage := (fs root / 'b.image') ensureCreateFile.
fileRequest := ITFileRequest new
title: 'Image file to open?';
filter: '.image';
currentFolder: fs root;
yourself.

widget := backend for: fileRequest.
widget doInteraction.
widget selectFile: bImage.
file := widget confirm.

self assert: widget fileNavigationSystem currentDirectory equals: fs root.
self assert: file equals: bImage
]

{ #category : 'tests' }
SpecInteractionTest >> testCanSelectAFolder [

| fileRequest fs folder bFolder |
fs := FileSystem memory.
(fs root / 'a') ensureCreateDirectory.
bFolder := (fs root / 'b') ensureCreateDirectory.
fileRequest := ITFileRequest new
beForFolderOpening;
title: 'Folder to open?';
currentFolder: fs root;
yourself.

widget := backend for: fileRequest.
widget doInteraction.
widget selectFile: bFolder.
folder := widget confirm.

self assert: widget fileNavigationSystem currentDirectory equals: fs root.
self assert: folder equals: bFolder
]
1 change: 1 addition & 0 deletions src/Interactions-Tests/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'Interactions-Tests' }

This file was deleted.

52 changes: 0 additions & 52 deletions src/Interactions-Widgets-Tests/ITInformationPresenterTest.class.st

This file was deleted.

53 changes: 0 additions & 53 deletions src/Interactions-Widgets-Tests/ITItemChooserPresenterTest.class.st

This file was deleted.

1 change: 0 additions & 1 deletion src/Interactions-Widgets-Tests/package.st

This file was deleted.

20 changes: 0 additions & 20 deletions src/Interactions-Widgets/ITConfirmationPresenter.class.st

This file was deleted.

Loading

0 comments on commit 45c9078

Please sign in to comment.