File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,14 @@ describe("SlotListTest", () => {
4444 assert . equal ( 0 , SlotList . NIL . length ) ;
4545 } ) ;
4646
47+ it ( "NIL_can_not_append_a_new_slot" , ( ) => {
48+ let list : SlotList = SlotList . NIL . append ( slotA ) ;
49+ // list should be a new SlotList with only one element
50+ assert . equal ( 1 , list . length ) ;
51+ // append a element to NIL should not change it's length
52+ assert . equal ( 0 , SlotList . NIL . length ) ;
53+ } ) ;
54+
4755 it ( "tail_defaults_to_NIL_if_omitted_in_constructor" , ( ) => {
4856 const noTail : SlotList = new SlotList ( slotA ) ;
4957 assert . equal ( SlotList . NIL , noTail . tail ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ describe("SlotTest", () => {
6969 assert . deepEqual ( received , expected ) ;
7070 } ) ;
7171
72+ it ( "execute0_with_once_enabled_should_remove_listener" , ( ) => {
73+ expected = [ ] ;
74+ slot = new Slot ( listener0 , signal , true ) ;
75+ slot . execute0 ( ) ;
76+ assert . deepEqual ( received , expected ) ;
77+ } ) ;
78+
7279 it ( "execute1_should_not_call_listener_when_disabled" , ( ) => {
7380 slot = new Slot ( listener1 , signal ) ;
7481 slot . enabled = false ;
@@ -100,6 +107,13 @@ describe("SlotTest", () => {
100107 assert . deepEqual ( received , expected ) ;
101108 } ) ;
102109
110+ it ( "execute1_with_once_enabled_should_remove_listener" , ( ) => {
111+ expected = [ 42 ] ;
112+ slot = new Slot ( listener1 , signal , true ) ;
113+ slot . execute1 ( expected [ 0 ] ) ;
114+ assert . deepEqual ( received , expected ) ;
115+ } ) ;
116+
103117 it ( "execute_should_not_call_listener_when_disabled" , ( ) => {
104118 slot = new Slot ( listener0 , signal ) ;
105119 slot . enabled = false ;
You can’t perform that action at this time.
0 commit comments