Skip to content

Commit 45282ea

Browse files
committed
Dry cleaning tests ✨
1 parent 846e892 commit 45282ea

8 files changed

+83
-74
lines changed

.jshintrc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
"node" : true,
1313
"browser" : true,
1414
"globals" : {
15-
"it" : false,
16-
"xit" : false,
17-
"describe" : false,
18-
"xdescribe" : false,
19-
"beforeEach" : false,
20-
"afterEach" : false,
21-
"expect" : false,
22-
"spyOn" : false
15+
"it" : true,
16+
"xit" : true,
17+
"describe" : true,
18+
"xdescribe" : true,
19+
"beforeEach" : true,
20+
"afterEach" : true,
21+
"expect" : true,
22+
"spyOn" : true
2323
}
24-
}
24+
}

tests/.jshintrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"curly": true,
3+
"eqeqeq": true,
4+
"immed": true,
5+
"latedef": true,
6+
"newcap": true,
7+
"noarg": true,
8+
"sub": true,
9+
"undef": true,
10+
"boss": true,
11+
"eqnull": true,
12+
"node": true,
13+
"browser": true,
14+
"globals": {
15+
"it": true,
16+
"xit": true,
17+
"describe": true,
18+
"xdescribe": true,
19+
"beforeEach": true,
20+
"afterEach": true,
21+
"expect": true,
22+
"spyOn": true,
23+
"jasmine": true,
24+
"$": true,
25+
"loadFixtures": true
26+
}
27+
}
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
/* globals $, jasmine, loadFixtures */
2-
3-
'use strict';
4-
51
jasmine.getFixtures().fixturesPath = 'tests/fixtures';
62

7-
describe('The `check` method', function() {
3+
describe('The `check` method', function () {
4+
'use strict';
85

9-
it('should exists', function() {
6+
it('should exists', function () {
107
loadFixtures('unchecked.html');
118
var el = $('body').checkboxes();
129
expect(el.data('checkboxes').check).toBeDefined();
1310
});
1411

15-
it('should be a function', function() {
12+
it('should be a function', function () {
1613
loadFixtures('unchecked.html');
1714
var el = $('body').checkboxes();
1815
expect(typeof el.data('checkboxes').check).toBe('function');
1916
});
2017

21-
it('should check all checkboxes in context', function() {
18+
it('should check all checkboxes in context', function () {
2219
loadFixtures('unchecked.html');
2320
var el = $('body').checkboxes('check');
2421
expect(el.find(':checkbox')).toBeChecked();
2522
});
2623

27-
it('should check specified checkbox', function() {
24+
it('should check specified checkbox', function () {
2825
// Check first checkbox.
2926
loadFixtures('unchecked.html');
3027
var el = $(':checkbox:first').parent().checkboxes('check');
@@ -33,16 +30,16 @@ describe('The `check` method', function() {
3330

3431
// Check last checkbox.
3532
loadFixtures('unchecked.html');
36-
var el = $(':checkbox:last').parent().checkboxes('check');
33+
el = $(':checkbox:last').parent().checkboxes('check');
3734
expect(el.find(':checkbox:last')).toBeChecked();
3835
expect(el.find(':checkbox:not(:last)')).toBeChecked();
3936
});
4037

41-
it('should check all checkboxes in context, but no disabled ones', function() {
38+
it('should check all checkboxes in context, but no disabled ones', function () {
4239
loadFixtures('unchecked.html');
4340
var el = $('body').checkboxes('check');
4441
expect(el.find(':checkbox:disabled')).not.toBeChecked();
4542
expect(el.find(':checkbox:not(:disabled)')).toBeChecked();
4643
});
4744

48-
});
45+
});
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
1-
/* globals $, jasmine, loadFixtures */
2-
3-
'use strict';
4-
51
jasmine.getFixtures().fixturesPath = 'tests/fixtures';
62

7-
describe('The `max` method', function() {
3+
describe('The `max` method', function () {
4+
'use strict';
85

9-
it('should exists', function() {
6+
it('should exists', function () {
107
loadFixtures('checked.html');
118
var el = $('body').checkboxes();
129
expect(el.data('checkboxes').max).toBeDefined();
1310
});
1411

15-
it('should be a function', function() {
12+
it('should be a function', function () {
1613
loadFixtures('checked.html');
1714
var el = $('body').checkboxes();
1815
expect(typeof el.data('checkboxes').max).toBe('function');
1916
});
2017

21-
it('should limit the number of checked checkboxes in context', function() {
18+
it('should limit the number of checked checkboxes in context', function () {
2219
loadFixtures('unchecked.html');
2320
var context = $('body');
2421
context.checkboxes('max', 3);
25-
context.find(':checkbox').each(function(i) {
22+
context.find(':checkbox').each(function (i) {
2623
$(this).click();
2724
expect($(this).prop('checked')).toBe(i < 3); // The first three should be checked.
2825
});
2926
});
3027

31-
});
28+
});
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
/* globals $, jasmine, loadFixtures */
2-
3-
'use strict';
4-
51
jasmine.getFixtures().fixturesPath = 'tests/fixtures';
62

7-
describe('The `range` method', function() {
3+
describe('The `range` method', function () {
4+
'use strict';
85

9-
it('should exists', function() {
6+
it('should exists', function () {
107
loadFixtures('checked.html');
118
var el = $('body').checkboxes();
129
expect(el.data('checkboxes').range).toBeDefined();
1310
});
1411

15-
it('should be a function', function() {
12+
it('should be a function', function () {
1613
loadFixtures('checked.html');
1714
var el = $('body').checkboxes();
1815
expect(typeof el.data('checkboxes').range).toBe('function');
1916
});
2017

21-
});
18+
});
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
/* globals $, jasmine, loadFixtures */
2-
3-
'use strict';
4-
51
jasmine.getFixtures().fixturesPath = 'tests/fixtures';
62

7-
describe('The jQuery checkboxes plugin', function() {
3+
describe('The jQuery checkboxes plugin', function () {
4+
'use strict';
85

9-
it('should exists', function() {
6+
it('should exists', function () {
107
expect($.fn.checkboxes).toBeDefined();
118
});
129

13-
it('should be a function', function() {
10+
it('should be a function', function () {
1411
expect(typeof $.fn.checkboxes).toBe('function');
1512
});
1613

17-
it('should create an instance in $.data', function() {
14+
it('should create an instance in $.data', function () {
1815
loadFixtures('checked.html');
1916
var el = $('body').checkboxes();
2017
expect(el.data('checkboxes')).toBeDefined();
2118
});
2219

23-
it('should not create an instance in $.data with empty element set', function() {
20+
it('should not create an instance in $.data with empty element set', function () {
2421
loadFixtures('checked.html');
2522
var el = $().checkboxes();
2623
expect(el.data('checkboxes')).not.toBeDefined();
2724
});
2825

29-
});
26+
});
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
1-
/* globals $, jasmine, loadFixtures */
2-
3-
'use strict';
4-
51
jasmine.getFixtures().fixturesPath = 'tests/fixtures';
62

7-
describe('The `toggle` method', function() {
3+
describe('The `toggle` method', function () {
4+
'use strict';
85

9-
it('should exists', function() {
6+
it('should exists', function () {
107
loadFixtures('mixed.html');
118
var el = $('body').checkboxes();
129
expect(el.data('checkboxes').toggle).toBeDefined();
1310
});
1411

15-
it('should be a function', function() {
12+
it('should be a function', function () {
1613
loadFixtures('mixed.html');
1714
var el = $('body').checkboxes();
1815
expect(typeof el.data('checkboxes').toggle).toBe('function');
1916
});
2017

21-
it('should toggle all checkboxes in context', function() {
18+
it('should toggle all checkboxes in context', function () {
2219
loadFixtures('mixed.html');
2320
var original = $('body').clone();
2421
var modified = $('body').checkboxes('toggle');
25-
modified.find(':checkbox:not(:disabled)').each(function(i) {
22+
modified.find(':checkbox:not(:disabled)').each(function (i) {
2623
expect($(this).prop('checked')).not.toBe(original.find(':checkbox:not(:disabled)').eq(i).prop('checked'));
2724
});
2825
});
2926

30-
it('should toggle specified checkbox', function() {
27+
it('should toggle specified checkbox', function () {
3128
// Check first checkbox.
3229
loadFixtures('mixed.html');
3330
var original = $(':checkbox:first').clone();
@@ -41,13 +38,13 @@ describe('The `toggle` method', function() {
4138
expect(modified.find(':checkbox:last').prop('checked')).not.toBe(original.prop('checked'));
4239
});
4340

44-
it('should toggle all checkboxes in context, but no disabled ones', function() {
41+
it('should toggle all checkboxes in context, but no disabled ones', function () {
4542
loadFixtures('mixed.html');
4643
var original = $('body').clone();
4744
var modified = $('body').checkboxes('toggle');
48-
modified.find(':checkbox:disabled').each(function(i) {
45+
modified.find(':checkbox:disabled').each(function (i) {
4946
expect($(this).prop('checked')).toBe(original.find(':checkbox:disabled').eq(i).prop('checked'));
5047
});
5148
});
5249

53-
});
50+
});
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
/* globals $, jasmine, loadFixtures */
2-
3-
'use strict';
4-
51
jasmine.getFixtures().fixturesPath = 'tests/fixtures';
62

7-
describe('The `uncheck` method', function() {
3+
describe('The `uncheck` method', function () {
4+
'use strict';
85

9-
it('should exists', function() {
6+
it('should exists', function () {
107
loadFixtures('checked.html');
118
var el = $('body').checkboxes();
129
expect(el.data('checkboxes').uncheck).toBeDefined();
1310
});
1411

15-
it('should be a function', function() {
12+
it('should be a function', function () {
1613
loadFixtures('checked.html');
1714
var el = $('body').checkboxes();
1815
expect(typeof el.data('checkboxes').uncheck).toBe('function');
1916
});
2017

21-
it('should uncheck all checkboxes in context', function() {
18+
it('should uncheck all checkboxes in context', function () {
2219
loadFixtures('checked.html');
2320
var el = $('body').checkboxes('uncheck');
2421
expect(el.find(':checkbox:not(:disabled)')).not.toBeChecked();
2522
});
2623

27-
it('should uncheck specified checkbox', function() {
24+
it('should uncheck specified checkbox', function () {
2825
// Check first checkbox.
2926
loadFixtures('checked.html');
3027
var el = $(':checkbox:first').parent().checkboxes('uncheck');
@@ -33,16 +30,16 @@ describe('The `uncheck` method', function() {
3330

3431
// Check last checkbox.
3532
loadFixtures('checked.html');
36-
var el = $(':checkbox:last').parent().checkboxes('uncheck');
33+
el = $(':checkbox:last').parent().checkboxes('uncheck');
3734
expect(el.find(':checkbox:last')).not.toBeChecked();
3835
expect(el.find(':checkbox:not(:last)')).toBeChecked();
3936
});
4037

41-
it('should check all checkboxes in context, but no disabled ones', function() {
38+
it('should check all checkboxes in context, but no disabled ones', function () {
4239
loadFixtures('checked.html');
4340
var el = $('body').checkboxes('uncheck');
4441
expect(el.find(':checkbox:disabled')).toBeChecked();
4542
expect(el.find(':checkbox:not(:disabled)')).not.toBeChecked();
4643
});
4744

48-
});
45+
});

0 commit comments

Comments
 (0)