|
| 1 | +'use strict'; |
| 2 | + |
1 | 3 | describe('formBespokeInput', function () {
|
2 |
| - var elm, scope; |
| 4 | + var elm, scope; |
3 | 5 |
|
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 | + }); |
9 | 11 |
|
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 () { |
39 | 13 |
|
| 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('@'); |
40 | 40 | });
|
41 | 41 |
|
| 42 | + }); |
| 43 | + |
42 | 44 | });
|
43 | 45 |
|
0 commit comments