From 6118e3357a476e9831b4354582cf7d5c86167982 Mon Sep 17 00:00:00 2001 From: imakewebthings Date: Wed, 11 Jan 2012 13:24:38 -0800 Subject: [PATCH] Fix case for #58 where slide number entered is higher than countNested total but in legal range of actual slide count --- extensions/goto/deck.goto.js | 1 + test/spec.goto.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/extensions/goto/deck.goto.js b/extensions/goto/deck.goto.js index ad79f82..eedba10 100644 --- a/extensions/goto/deck.goto.js +++ b/extensions/goto/deck.goto.js @@ -143,6 +143,7 @@ the deck container. ndx = parseInt($field.val(), 10); if (!$[deck]('getOptions').countNested) { + if (ndx >= rootCounter) return false; $.each($[deck]('getSlides'), function(i, $slide) { if ($slide.data('rootIndex') === ndx) { ndx = i + 1; diff --git a/test/spec.goto.js b/test/spec.goto.js index f78017e..391d80c 100644 --- a/test/spec.goto.js +++ b/test/spec.goto.js @@ -118,16 +118,25 @@ describe('Deck JS Quick Go-To', function() { }); describe('countNested false', function() { - it('should ignore nested slides when given a slide number', function() { - loadFixtures('nesteds.html'); + beforeEach(function() { + loadFixtures('nesteds.html'); $.deck('.slide', { countNested: false }); - $.deck('showGoTo'); + }); + + it('should ignore nested slides when given a slide number', function() { $(defaults.selectors.gotoInput).val('4'); $(defaults.selectors.gotoForm).submit(); expect($.deck('getSlide')).toHaveId('after'); }); + + it('should respect top side of new slide range', function() { + $.deck('go', 0); + $(defaults.selectors.gotoInput).val('6'); + $(defaults.selectors.gotoForm).submit(); + expect($.deck('getSlide')).toHaveId('slide-0'); + }); }); }); \ No newline at end of file -- 2.11.4.GIT