Fix case for #58 where slide number entered is higher than countNested total but...
authorimakewebthings <[email protected]>
Wed, 11 Jan 2012 21:24:38 +0000 (11 13:24 -0800)
committerimakewebthings <[email protected]>
Wed, 11 Jan 2012 21:24:38 +0000 (11 13:24 -0800)
extensions/goto/deck.goto.js
test/spec.goto.js

index ad79f82..eedba10 100644 (file)
@@ -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;
index f78017e..391d80c 100644 (file)
@@ -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