11Class {
22 #name : #BlFocusProcessorTest ,
33 #superclass : #TestCase ,
4- #category : #' Bloc-Examples-Event-Scripter'
4+ #instVars : [
5+ ' scripter'
6+ ],
7+ #category : #' Bloc-Examples-EventHandling'
58}
69
710{ #category : #running }
@@ -171,14 +174,25 @@ BlFocusProcessorTest >> newScripterElement [
171174 yourself
172175]
173176
177+ { #category : #running }
178+ BlFocusProcessorTest >> setUp [
179+
180+ super setUp.
181+ scripter := BlDevScripter new .
182+ scripter element: self newScripterElement
183+ ]
184+
185+ { #category : #running }
186+ BlFocusProcessorTest >> tearDown [
187+
188+ scripter close.
189+ super tearDown
190+ ]
191+
174192{ #category : #' tests - lose focus' }
175193BlFocusProcessorTest >> testLoseFocus01GiveFocusToChild1 [
176194
177- | aScripter |
178- aScripter := BlDevScripter new .
179- aScripter element: self newScripterElement.
180-
181- aScripter substeps: ' Give focus to child-1' do: [ :aStep |
195+ scripter substeps: ' Give focus to child-1' do: [ :aStep |
182196 aStep requestFocus onChildNamed: #' child-1' .
183197
184198 aStep check
@@ -264,22 +278,22 @@ BlFocusProcessorTest >> testLoseFocus01GiveFocusToChild1 [
264278 aStep check
265279 label: ' Check focus owner' ;
266280 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
267- equals: [ aScripter element childWithId: #' child-1' ];
281+ equals: [ scripter element childWithId: #' child-1' ];
268282 onFocusProcessor ].
269283
270- ^ aScripter syncContinue
284+ scripter syncContinue
271285]
272286
273287{ #category : #' tests - lose focus' }
274288BlFocusProcessorTest >> testLoseFocus02RemoveChild1 [
275289
276- | aScripter aChild1 |
277- aScripter := self testLoseFocus01GiveFocusToChild1.
290+ | aChild1 |
291+ self testLoseFocus01GiveFocusToChild1.
278292
279- aChild1 := aScripter root childWithId: #' child-1' .
280- aScripter set key: #' child-1' value: [ aChild1 ].
293+ aChild1 := scripter root childWithId: #' child-1' .
294+ scripter set key: #' child-1' value: [ aChild1 ].
281295
282- aScripter substeps: ' Remove child-1' do: [ :aStep |
296+ scripter substeps: ' Remove child-1' do: [ :aStep |
283297 aStep do
284298 action: [ :anElement | anElement removeFromParent ];
285299 id: #' child-1' .
@@ -372,21 +386,21 @@ BlFocusProcessorTest >> testLoseFocus02RemoveChild1 [
372386 aStep check
373387 label: ' Check focus owner' ;
374388 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
375- equals: [ aScripter element childWithId: #' container-1' ];
389+ equals: [ scripter element childWithId: #' container-1' ];
376390 onFocusProcessor ].
377391
378- ^ aScripter syncContinue
392+ scripter syncContinue
379393]
380394
381395{ #category : #' tests - lose focus' }
382396BlFocusProcessorTest >> testLoseFocus03AddBackChild1 [
383397
384- | aScripter aChild1 |
385- aScripter := self testLoseFocus02RemoveChild1.
398+ | aChild1 |
399+ self testLoseFocus02RemoveChild1.
386400
387- aChild1 := aScripter userData at: #' child-1' .
401+ aChild1 := scripter userData at: #' child-1' .
388402
389- aScripter substeps: ' Add child-1 back' do: [ :aStep |
403+ scripter substeps: ' Add child-1 back' do: [ :aStep |
390404 aStep do
391405 action: [ :anElement | anElement addChild: aChild1 ];
392406 id: #' container-1' .
@@ -479,20 +493,16 @@ BlFocusProcessorTest >> testLoseFocus03AddBackChild1 [
479493 aStep check
480494 label: ' Check focus owner' ;
481495 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
482- equals: [ aScripter element childWithId: #' child-1' ];
496+ equals: [ scripter element childWithId: #' child-1' ];
483497 onFocusProcessor ].
484498
485- ^ aScripter syncContinue
499+ scripter syncContinue
486500]
487501
488502{ #category : #' tests - request focus' }
489503BlFocusProcessorTest >> testRequestFocus01Parent [
490504
491- | aScripter |
492- aScripter := BlDevScripter new .
493- aScripter element: self newScripterElement.
494-
495- aScripter substeps: ' Request focus on parent' do: [ :aStep |
505+ scripter substeps: ' Request focus on parent' do: [ :aStep |
496506 aStep requestFocus.
497507
498508 aStep check
@@ -518,19 +528,18 @@ BlFocusProcessorTest >> testRequestFocus01Parent [
518528 aStep check
519529 label: ' Check focus owner' ;
520530 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
521- equals: [ aScripter element ];
531+ equals: [ scripter element ];
522532 onFocusProcessor ].
523533
524- ^ aScripter syncContinue
534+ scripter syncContinue
525535]
526536
527537{ #category : #' tests - request focus' }
528538BlFocusProcessorTest >> testRequestFocus02Container1 [
529539
530- | aScripter |
531- aScripter := self testRequestFocus01Parent.
540+ self testRequestFocus01Parent.
532541
533- aScripter substeps: ' Request focus on container-1' do: [ :aStep |
542+ scripter substeps: ' Request focus on container-1' do: [ :aStep |
534543 aStep requestFocus onChildNamed: #' container-1' .
535544
536545 aStep check
@@ -576,19 +585,18 @@ BlFocusProcessorTest >> testRequestFocus02Container1 [
576585 aStep check
577586 label: ' Check focus owner' ;
578587 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
579- equals: [ aScripter element childWithId: #' container-1' ];
588+ equals: [ scripter element childWithId: #' container-1' ];
580589 onFocusProcessor ].
581590
582- ^ aScripter syncContinue
591+ scripter syncContinue
583592]
584593
585594{ #category : #' tests - request focus' }
586595BlFocusProcessorTest >> testRequestFocus03Container2 [
587596
588- | aScripter |
589- aScripter := self testRequestFocus02Container1.
597+ self testRequestFocus02Container1.
590598
591- aScripter substeps: ' Request focus on container-2' do: [ :aStep |
599+ scripter substeps: ' Request focus on container-2' do: [ :aStep |
592600 aStep requestFocus onChildNamed: #' container-2' .
593601
594602 aStep check
@@ -654,19 +662,18 @@ BlFocusProcessorTest >> testRequestFocus03Container2 [
654662 aStep check
655663 label: ' Check focus owner' ;
656664 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
657- equals: [ aScripter element childWithId: #' container-2' ];
665+ equals: [ scripter element childWithId: #' container-2' ];
658666 onFocusProcessor ].
659667
660- ^ aScripter syncContinue
668+ scripter syncContinue
661669]
662670
663671{ #category : #' tests - request focus' }
664672BlFocusProcessorTest >> testRequestFocus04Child1 [
665673
666- | aScripter |
667- aScripter := self testRequestFocus03Container2.
674+ self testRequestFocus03Container2.
668675
669- aScripter substeps: ' Request focus on child-1' do: [ :aStep |
676+ scripter substeps: ' Request focus on child-1' do: [ :aStep |
670677 aStep requestFocus onChildNamed: #' child-1' .
671678
672679 aStep check
@@ -752,19 +759,18 @@ BlFocusProcessorTest >> testRequestFocus04Child1 [
752759 aStep check
753760 label: ' Check focus owner' ;
754761 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
755- equals: [ aScripter element childWithId: #' child-1' ];
762+ equals: [ scripter element childWithId: #' child-1' ];
756763 onFocusProcessor ].
757764
758- ^ aScripter syncContinue
765+ scripter syncContinue
759766]
760767
761768{ #category : #' tests - request focus' }
762769BlFocusProcessorTest >> testRequestFocus05Child4 [
763770
764- | aScripter |
765- aScripter := self testRequestFocus04Child1.
771+ self testRequestFocus04Child1.
766772
767- aScripter substeps: ' Request focus on child-4' do: [ :aStep |
773+ scripter substeps: ' Request focus on child-4' do: [ :aStep |
768774 aStep requestFocus onChildNamed: #' child-4' .
769775
770776 aStep check
@@ -870,19 +876,18 @@ BlFocusProcessorTest >> testRequestFocus05Child4 [
870876 aStep check
871877 label: ' Check focus owner' ;
872878 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
873- equals: [ aScripter element childWithId: #' child-4' ];
879+ equals: [ scripter element childWithId: #' child-4' ];
874880 onFocusProcessor ].
875881
876- ^ aScripter syncContinue
882+ scripter syncContinue
877883]
878884
879885{ #category : #' tests - request focus' }
880886BlFocusProcessorTest >> testRequestFocus06Container1 [
881887
882- | aScripter |
883- aScripter := self testRequestFocus05Child4.
888+ self testRequestFocus05Child4.
884889
885- aScripter substeps: ' Request focus on container-1' do: [ :aStep |
890+ scripter substeps: ' Request focus on container-1' do: [ :aStep |
886891 aStep requestFocus onChildNamed: #' container-1' .
887892
888893 aStep check
@@ -988,8 +993,8 @@ BlFocusProcessorTest >> testRequestFocus06Container1 [
988993 aStep check
989994 label: ' Check focus owner' ;
990995 value: [ :aFocusProcessor | aFocusProcessor focusOwner ]
991- equals: [ aScripter element childWithId: #' container-1' ];
996+ equals: [ scripter element childWithId: #' container-1' ];
992997 onFocusProcessor ].
993998
994- ^ aScripter syncContinue
999+ scripter syncContinue
9951000]
0 commit comments