File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*!
2
2
Deck JS - deck.navigation
3
- Copyright (c) 2011 Caleb Troughton
3
+ Copyright (c) 2011-2013 Caleb Troughton
4
4
Dual licensed under the MIT license.
5
5
https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
6
6
*/
@@ -24,8 +24,10 @@ This module adds clickable previous and next links to the deck.
24
24
var $nextButton = $ ( options . selectors . nextLink ) ;
25
25
26
26
$prevButton . toggleClass ( options . classes . navDisabled , to === 0 ) ;
27
+ $prevButton . attr ( 'aria-disabled' , to === 0 ) ;
27
28
$prevButton . attr ( 'href' , hrefBase + '#' + ( prevId ? prevId : '' ) ) ;
28
29
$nextButton . toggleClass ( options . classes . navDisabled , to === lastIndex ) ;
30
+ $nextButton . attr ( 'aria-disabled' , to === lastIndex ) ;
29
31
$nextButton . attr ( 'href' , hrefBase + '#' + ( nextId ? nextId : '' ) ) ;
30
32
} ;
31
33
Original file line number Diff line number Diff line change @@ -29,12 +29,22 @@ describe('Deck JS Navigation Buttons', function() {
29
29
expect ( $ ( defaults . selectors . previousLink ) ) . toHaveClass ( defaults . classes . navDisabled ) ;
30
30
} ) ;
31
31
32
+ it ( 'should add aria-disabled to previous link if on first slide' , function ( ) {
33
+ $ . deck ( 'go' , 0 ) ;
34
+ expect ( $ ( defaults . selectors . previousLink ) ) . toHaveAttr ( 'aria-disabled' , 'true' ) ;
35
+ } ) ;
36
+
32
37
it ( 'should add the disabled class to the next link if on last slide' , function ( ) {
33
38
expect ( $ ( defaults . selectors . nextLink ) ) . not . toHaveClass ( defaults . classes . navDisabled ) ;
34
39
$ . deck ( 'go' , $ . deck ( 'getSlides' ) . length - 1 ) ;
35
40
expect ( $ ( defaults . selectors . nextLink ) ) . toHaveClass ( defaults . classes . navDisabled ) ;
36
41
} ) ;
37
42
43
+ it ( 'should add aria-disabled to next link if on last slide' , function ( ) {
44
+ $ . deck ( 'go' , $ . deck ( 'getSlides' ) . length - 1 ) ;
45
+ expect ( $ ( defaults . selectors . nextLink ) ) . toHaveAttr ( 'aria-disabled' , 'true' ) ;
46
+ } ) ;
47
+
38
48
it ( 'should not start disabled if deck initialized in the middle' , function ( ) {
39
49
$ . deck ( 'go' , 2 ) ;
40
50
$ . deck ( '.slide' ) ;
@@ -50,4 +60,4 @@ describe('Deck JS Navigation Buttons', function() {
50
60
expect ( $ ( defaults . selectors . previousLink ) . attr ( 'href' ) ) . toMatch ( '#custom-id' ) ;
51
61
expect ( $ ( defaults . selectors . nextLink ) . attr ( 'href' ) ) . toMatch ( '#slide-3' ) ;
52
62
} ) ;
53
- } ) ;
63
+ } ) ;
You can’t perform that action at this time.
0 commit comments