@@ -158,13 +158,13 @@ describe('GridNavigation', () => {
158158 expect ( gridNav . peek ( direction . Up , from , 'continuous' ) ) . toEqual ( { row : 3 , col : 2 } ) ;
159159 } ) ;
160160
161- it ( 'should return the next coordinates even if all cells are disabled' , ( ) => {
161+ it ( 'should return undefined if all cells are disabled' , ( ) => {
162162 cells . flat ( ) . forEach ( cell => cell . disabled . set ( true ) ) ;
163163 gridNav . gotoCoords ( { row : 1 , col : 0 } ) ;
164164
165165 const nextCoords = gridNav . peek ( direction . Up , gridFocus . activeCoords ( ) ) ;
166166
167- expect ( nextCoords ) . toEqual ( { row : 0 , col : 0 } ) ;
167+ expect ( nextCoords ) . toBeUndefined ( ) ;
168168 } ) ;
169169
170170 it ( 'should return undefined if all cells are disabled when softDisabled is false' , ( ) => {
@@ -210,23 +210,12 @@ describe('GridNavigation', () => {
210210 expect ( gridNav . peek ( direction . Down , from , 'continuous' ) ) . toEqual ( { row : 0 , col : 2 } ) ;
211211 } ) ;
212212
213- it ( 'should return the next coordinates even if all cells are disabled' , ( ) => {
213+ it ( 'should return undefined if completely disabled' , ( ) => {
214214 cells . flat ( ) . forEach ( cell => cell . disabled . set ( true ) ) ;
215215 gridNav . gotoCoords ( { row : 1 , col : 0 } ) ;
216216
217217 const nextCoords = gridNav . peek ( direction . Down , gridFocus . activeCoords ( ) ) ;
218218
219- expect ( nextCoords ) . toEqual ( { row : 2 , col : 0 } ) ;
220- } ) ;
221-
222- it ( 'should return undefined if all cells are disabled when softDisabled is false' , ( ) => {
223- const { gridNav} = setupGridNavigation ( signal ( cells ) , {
224- softDisabled : signal ( false ) ,
225- } ) ;
226- cells . flat ( ) . forEach ( cell => cell . disabled . set ( true ) ) ;
227-
228- const nextCoords = gridNav . peek ( direction . Down , { row : 1 , col : 0 } ) ;
229-
230219 expect ( nextCoords ) . toBeUndefined ( ) ;
231220 } ) ;
232221
@@ -262,22 +251,11 @@ describe('GridNavigation', () => {
262251 expect ( gridNav . peek ( direction . Left , from , 'continuous' ) ) . toEqual ( { row : 3 , col : 2 } ) ;
263252 } ) ;
264253
265- it ( 'should return the next coordinates even if all cells are disabled' , ( ) => {
266- cells . flat ( ) . forEach ( c => c . disabled . set ( true ) ) ;
267- gridNav . gotoCoords ( { row : 1 , col : 0 } ) ;
268-
269- const nextCoords = gridNav . peek ( direction . Left , gridFocus . activeCoords ( ) ) ;
270-
271- expect ( nextCoords ) . toEqual ( { row : 1 , col : 2 } ) ;
272- } ) ;
273-
274- it ( 'should return undefined if all cells are disabled when softDisabled is false' , ( ) => {
275- const { gridNav} = setupGridNavigation ( signal ( cells ) , {
276- softDisabled : signal ( false ) ,
277- } ) ;
254+ it ( 'should return undefined if completely disabled' , ( ) => {
278255 cells . flat ( ) . forEach ( cell => cell . disabled . set ( true ) ) ;
256+ gridNav . gotoCoords ( { row : 1 , col : 0 } ) ;
279257
280- const nextCoords = gridNav . peek ( direction . Left , { row : 1 , col : 0 } ) ;
258+ const nextCoords = gridNav . peek ( direction . Down , gridFocus . activeCoords ( ) ) ;
281259
282260 expect ( nextCoords ) . toBeUndefined ( ) ;
283261 } ) ;
@@ -314,22 +292,11 @@ describe('GridNavigation', () => {
314292 expect ( gridNav . peek ( direction . Right , from , 'continuous' ) ) . toEqual ( { row : 1 , col : 0 } ) ;
315293 } ) ;
316294
317- it ( 'should return the next coordinates even if all cells are disabled' , ( ) => {
318- cells . flat ( ) . forEach ( c => c . disabled . set ( true ) ) ;
319- gridNav . gotoCoords ( { row : 1 , col : 0 } ) ;
320-
321- const nextCoords = gridNav . peek ( direction . Right , gridFocus . activeCoords ( ) ) ;
322-
323- expect ( nextCoords ) . toEqual ( { row : 1 , col : 1 } ) ;
324- } ) ;
325-
326- it ( 'should return undefined if all cells are disabled when softDisabled is false' , ( ) => {
327- const { gridNav} = setupGridNavigation ( signal ( cells ) , {
328- softDisabled : signal ( false ) ,
329- } ) ;
295+ it ( 'should return undefined if completely disabled' , ( ) => {
330296 cells . flat ( ) . forEach ( cell => cell . disabled . set ( true ) ) ;
297+ gridNav . gotoCoords ( { row : 1 , col : 0 } ) ;
331298
332- const nextCoords = gridNav . peek ( direction . Right , { row : 1 , col : 0 } ) ;
299+ const nextCoords = gridNav . peek ( direction . Down , gridFocus . activeCoords ( ) ) ;
333300
334301 expect ( nextCoords ) . toBeUndefined ( ) ;
335302 } ) ;
0 commit comments