Skip to content

Commit e9bbc7c

Browse files
committed
Unit tests under jshint
1 parent d917fef commit e9bbc7c

14 files changed

+2699
-2474
lines changed

test/unit/baseControllerSpec.js

Lines changed: 724 additions & 699 deletions
Large diffs are not rendered by default.

test/unit/dataEventSpec.js

Lines changed: 285 additions & 284 deletions
Large diffs are not rendered by default.

test/unit/filters.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
describe('filter', function() {
1+
'use strict';
22

3-
beforeEach(angular.mock.module('formsAngular'));
3+
describe('filter', function () {
44

5-
describe('title case', function() {
5+
beforeEach(angular.mock.module('formsAngular'));
66

7-
it('should convert models with underscores appropriately',
8-
inject(function($filter) {
9-
expect($filter('titleCase')("b_using_options", false)).toBe('B Using Options');
10-
expect($filter('titleCase')("b_using_options", true)).toBe('BUsingOptions');
11-
}
12-
)
13-
);
14-
});
7+
describe('title case', function () {
8+
9+
it('should convert models with underscores appropriately',
10+
inject(function ($filter) {
11+
expect($filter('titleCase')('b_using_options', false)).toBe('B Using Options');
12+
expect($filter('titleCase')('b_using_options', true)).toBe('BUsingOptions');
13+
}
14+
)
15+
);
16+
});
1517
});

test/unit/formBespokeSpec.js

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
1+
'use strict';
2+
13
describe('formBespokeInput', function () {
2-
var elm, scope;
4+
var elm, scope;
35

4-
// load the form code
5-
beforeEach(function(){
6-
angular.mock.module('formsAngular');
7-
angular.mock.module('myDemoApp');
8-
});
6+
// load the form code
7+
beforeEach(function () {
8+
angular.mock.module('formsAngular');
9+
angular.mock.module('myDemoApp');
10+
});
911

10-
describe('supports override directives for fields', function () {
11-
12-
beforeEach(
13-
inject(function ($rootScope, $controller, $compile) {
14-
elm = angular.element(
15-
'<form name="myForm" class="form-horizontal compact"> ' +
16-
'<form-input schema="schema"></form-input>' +
17-
'</form>');
18-
scope = $rootScope;
19-
scope.schema = [
20-
{name: "email", id: "1", label: "Email", type: "text", directive: "email-field"},
21-
{name: "name", id: "2", label: "Name", type: "text"}
22-
];
23-
$compile(elm)(scope);
24-
scope.$digest();
25-
}));
26-
27-
it('field should have prefix', function () {
28-
var input = elm.find('input');
29-
expect(input.length).toBe(2);
30-
input = elm.find('input:first');
31-
expect(input).toHaveClass('ng-pristine');
32-
expect(input).toHaveClass('ng-valid');
33-
expect(input.attr('id')).toBe('1');
34-
expect(input.attr('type')).toBe('email');
35-
var prepend = elm.find('div.input-prepend');
36-
expect(prepend.length).toBe(1);
37-
expect(prepend.text()).toBe('@');
38-
});
12+
describe('supports override directives for fields', function () {
3913

14+
beforeEach(
15+
inject(function ($rootScope, $controller, $compile) {
16+
elm = angular.element(
17+
'<form name="myForm" class="form-horizontal compact"> ' +
18+
'<form-input schema="schema"></form-input>' +
19+
'</form>');
20+
scope = $rootScope;
21+
scope.schema = [
22+
{name: 'email', id: '1', label: 'Email', type: 'text', directive: 'email-field'},
23+
{name: 'name', id: '2', label: 'Name', type: 'text'}
24+
];
25+
$compile(elm)(scope);
26+
scope.$digest();
27+
}));
28+
29+
it('field should have prefix', function () {
30+
var input = elm.find('input');
31+
expect(input.length).toBe(2);
32+
input = elm.find('input:first');
33+
expect(input).toHaveClass('ng-pristine');
34+
expect(input).toHaveClass('ng-valid');
35+
expect(input.attr('id')).toBe('1');
36+
expect(input.attr('type')).toBe('email');
37+
var prepend = elm.find('div.input-prepend');
38+
expect(prepend.length).toBe(1);
39+
expect(prepend.text()).toBe('@');
4040
});
4141

42+
});
43+
4244
});
4345

0 commit comments

Comments
 (0)