Skip to content

Commit 6118e33

Browse files
Fix case for imakewebthings#58 where slide number entered is higher than countNested total but in legal range of actual slide count
1 parent d027a17 commit 6118e33

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

extensions/goto/deck.goto.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ the deck container.
143143
ndx = parseInt($field.val(), 10);
144144

145145
if (!$[deck]('getOptions').countNested) {
146+
if (ndx >= rootCounter) return false;
146147
$.each($[deck]('getSlides'), function(i, $slide) {
147148
if ($slide.data('rootIndex') === ndx) {
148149
ndx = i + 1;

test/spec.goto.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,25 @@ describe('Deck JS Quick Go-To', function() {
118118
});
119119

120120
describe('countNested false', function() {
121-
it('should ignore nested slides when given a slide number', function() {
122-
loadFixtures('nesteds.html');
121+
beforeEach(function() {
122+
loadFixtures('nesteds.html');
123123
$.deck('.slide', {
124124
countNested: false
125125
});
126-
127126
$.deck('showGoTo');
127+
});
128+
129+
it('should ignore nested slides when given a slide number', function() {
128130
$(defaults.selectors.gotoInput).val('4');
129131
$(defaults.selectors.gotoForm).submit();
130132
expect($.deck('getSlide')).toHaveId('after');
131133
});
134+
135+
it('should respect top side of new slide range', function() {
136+
$.deck('go', 0);
137+
$(defaults.selectors.gotoInput).val('6');
138+
$(defaults.selectors.gotoForm).submit();
139+
expect($.deck('getSlide')).toHaveId('slide-0');
140+
});
132141
});
133142
});

0 commit comments

Comments
 (0)