File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ /* globals $, jasmine, loadFixtures */
2+
3+ 'use strict' ;
4+
5+ jasmine . getFixtures ( ) . fixturesPath = 'tests/fixtures' ;
6+
7+ describe ( 'The `max` method' , function ( ) {
8+
9+ it ( 'should exists' , function ( ) {
10+ loadFixtures ( 'checked.html' ) ;
11+ var el = $ ( 'body' ) . checkboxes ( ) ;
12+ expect ( el . data ( 'checkboxes' ) . max ) . toBeDefined ( ) ;
13+ } ) ;
14+
15+ it ( 'should be a function' , function ( ) {
16+ loadFixtures ( 'checked.html' ) ;
17+ var el = $ ( 'body' ) . checkboxes ( ) ;
18+ expect ( typeof el . data ( 'checkboxes' ) . max ) . toBe ( 'function' ) ;
19+ } ) ;
20+
21+ it ( 'should limit the number of checked checkboxes in context' , function ( ) {
22+ loadFixtures ( 'unchecked.html' ) ;
23+ var context = $ ( 'body' ) ;
24+ context . checkboxes ( 'max' , 3 ) ;
25+ context . find ( ':checkbox' ) . each ( function ( i ) {
26+ $ ( this ) . click ( ) ;
27+ expect ( $ ( this ) . prop ( 'checked' ) ) . toBe ( i < 3 ) ; // The first three should be checked.
28+ } ) ;
29+ } ) ;
30+
31+ } ) ;
You can’t perform that action at this time.
0 commit comments