Skip to content

Commit eb8e5c2

Browse files
committed
Created spec for the max method.
1 parent 9c9a17a commit eb8e5c2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
});

0 commit comments

Comments
 (0)