@@ -32,6 +32,7 @@ describe('redux/actions.js', () => {
3232 sinon . test ( function ( ) {
3333 const store = createStore ( ( state = {
3434 '@@keys' : {
35+ current : { } ,
3536 binderId : { active : false , elements : [ { id : '1' } ] } ,
3637 binderId2 : { active : true , elements : [ { id : '2' } ] } ,
3738 } ,
@@ -45,8 +46,7 @@ describe('redux/actions.js', () => {
4546 state : {
4647 binderId : { active : true , elements : { 0 : { id : '1' } } , selectedId : '1' } ,
4748 binderId2 : { active : false , elements : { 0 : { id : '2' } } } ,
48- currentStrapeId : 'binderId' ,
49- selectedId : '1' ,
49+ current : { binderId : 'binderId' , selectedId : '1' } ,
5050 } ,
5151 } ) ;
5252 actions . _activeKeyBinder ( 'binderId' ) ;
@@ -66,6 +66,7 @@ describe('redux/actions.js', () => {
6666 it ( 'should keep in memory the selected Id when memory is true' , sinon . test ( function ( ) {
6767 const store = createStore ( ( state = {
6868 '@@keys' : {
69+ current : { } ,
6970 binderId : { active : false , selectedId : '2' , elements : [ { id : '1' } ] } ,
7071 binderId2 : { active : true , selectedId : '3' } ,
7172 } ,
@@ -79,8 +80,7 @@ describe('redux/actions.js', () => {
7980 state : {
8081 binderId : { active : true , elements : { 0 : { id : '1' } } , selectedId : '2' } ,
8182 binderId2 : { active : false , selectedId : '3' } ,
82- currentStrapeId : 'binderId' ,
83- selectedId : '2' ,
83+ current : { selectedId : '2' , binderId : 'binderId' } ,
8484 } ,
8585 } ) ;
8686 actions . _activeKeyBinder ( 'binderId' , null , true ) ;
@@ -90,6 +90,7 @@ describe('redux/actions.js', () => {
9090 it ( 'should add new binder to store if not exists yet' , sinon . test ( function ( ) {
9191 const store = createStore ( ( state = {
9292 '@@keys' : {
93+ current : { } ,
9394 binderId : { active : false } ,
9495 } ,
9596 } ) => state ) ;
@@ -99,13 +100,18 @@ describe('redux/actions.js', () => {
99100 . once ( )
100101 . withArgs ( {
101102 type : actions . ADD_KEYBINDER_TO_STORE ,
102- state : { binderId : { active : false } , binderId2 : { active : false , id : 'binderId2' } } ,
103+ state : {
104+ binderId : { active : false } ,
105+ binderId2 : { active : false , id : 'binderId2' } ,
106+ current : { } ,
107+ } ,
103108 } ) ;
104109 actions . addKeyBinderToStore ( 'binderId2' , false ) ;
105110 } ) ) ;
106111 it ( 'should activated binder when active is true' , sinon . test ( function ( ) {
107112 const store = createStore ( ( state = {
108113 '@@keys' : {
114+ current : { } ,
109115 binderId : { active : false } ,
110116 } ,
111117 } ) => state ) ;
@@ -115,13 +121,18 @@ describe('redux/actions.js', () => {
115121 . once ( )
116122 . withArgs ( {
117123 type : actions . ADD_KEYBINDER_TO_STORE ,
118- state : { binderId : { active : false } , binderId2 : { active : true , id : 'binderId2' } } ,
124+ state : {
125+ binderId : { active : false } ,
126+ binderId2 : { active : true , id : 'binderId2' } ,
127+ current : { selectedId : undefined , binderId : 'binderId2' } ,
128+ } ,
119129 } ) ;
120130 actions . addKeyBinderToStore ( 'binderId2' , true ) ;
121131 } ) ) ;
122132 it ( 'should not dipatch if binderId already exists in state' , sinon . test ( function ( ) {
123133 const store = createStore ( ( state = {
124134 '@@keys' : {
135+ current : { } ,
125136 binderId : { active : false } ,
126137 } ,
127138 } ) => state ) ;
@@ -136,6 +147,7 @@ describe('redux/actions.js', () => {
136147 it ( 'should update margin and selectedId to state' , sinon . test ( function ( ) {
137148 const store = createStore ( ( state = {
138149 '@@keys' : {
150+ current : { selectedId : null } ,
139151 binderId : { active : false , selectedId : 1 , marginLeft : 0 } ,
140152 } ,
141153 } ) => state ) ;
@@ -146,8 +158,8 @@ describe('redux/actions.js', () => {
146158 . withArgs ( {
147159 type : actions . UPDATE_SELECTED_KEY ,
148160 state : {
149- selectedId : 2 ,
150161 binderId : { active : false , selectedId : 2 , marginLeft : 10 } ,
162+ current : { selectedId : 2 } ,
151163 } ,
152164 } ) ;
153165 actions . updateSelectedId ( 'binderId' , 2 , 10 ) ;
@@ -194,4 +206,14 @@ describe('redux/actions.js', () => {
194206 startSpy . should . have . been . not . called ;
195207 } ) ) ;
196208 } ) ;
209+ describe ( 'bindersKeys' , ( ) => {
210+ it ( 'should delete current keys and return list of objet keys' , ( ) => {
211+ const object = {
212+ current : { } ,
213+ binder1 : { } ,
214+ binder2 : { } ,
215+ } ;
216+ actions . bindersKeys ( object ) . should . eql ( [ 'binder1' , 'binder2' ] ) ;
217+ } ) ;
218+ } ) ;
197219} ) ;
0 commit comments