OLD | NEW |
1 library ng_cloak_spec; | 1 library ng_cloak_spec; |
2 | 2 |
3 import '../_specs.dart'; | 3 import '../_specs.dart'; |
4 | 4 |
5 main() { | 5 main() { |
6 describe('NgCloak', () { | 6 describe('NgCloak', () { |
7 TestBed _; | 7 TestBed _; |
8 | 8 |
9 beforeEach(inject((TestBed tb) => _ = tb)); | 9 beforeEach((TestBed tb) => _ = tb); |
10 | 10 |
11 | 11 |
12 it('should get removed when an element is compiled', () { | 12 it('should get removed when an element is compiled', () { |
13 var element = $('<div ng-cloak></div>'); | 13 var element = e('<div ng-cloak></div>'); |
14 expect(element.attr('ng-cloak')).toEqual(''); | 14 expect(element.attributes['ng-cloak']).toEqual(''); |
15 _.compile(element); | 15 _.compile([element]); |
16 expect(element.attr('ng-cloak')).toBeNull(); | 16 expect(element.attributes['ng-cloak']).toBeNull(); |
17 }); | 17 }); |
18 | 18 |
19 | 19 |
20 it('should remove ngCloak class from a compiled element with attribute', ()
{ | 20 it('should remove ngCloak class from a compiled element with attribute', ()
{ |
21 var element = $('<div ng-cloak class="foo ng-cloak bar"></div>'); | 21 var element = e('<div ng-cloak class="foo ng-cloak bar"></div>'); |
22 | 22 |
23 expect(element.hasClass('foo')).toBe(true); | 23 expect(element).toHaveClass('foo'); |
24 expect(element.hasClass('ng-cloak')).toBe(true); | 24 expect(element).toHaveClass('ng-cloak'); |
25 expect(element.hasClass('bar')).toBe(true); | 25 expect(element).toHaveClass('bar'); |
26 | 26 |
27 _.compile(element); | 27 _.compile(element); |
28 | 28 |
29 expect(element.hasClass('foo')).toBe(true); | 29 expect(element).toHaveClass('foo'); |
30 expect(element.hasClass('ng-cloak')).toBe(false); | 30 expect(element).not.toHaveClass('ng-cloak'); |
31 expect(element.hasClass('bar')).toBe(true); | 31 expect(element).toHaveClass('bar'); |
32 }); | 32 }); |
33 | 33 |
34 | 34 |
35 it('should remove ngCloak class from a compiled element', () { | 35 it('should remove ngCloak class from a compiled element', () { |
36 var element = $('<div class="foo ng-cloak bar"></div>'); | 36 var element = e('<div class="foo ng-cloak bar"></div>'); |
37 | 37 |
38 expect(element.hasClass('foo')).toBe(true); | 38 expect(element).toHaveClass('foo'); |
39 expect(element.hasClass('ng-cloak')).toBe(true); | 39 expect(element).toHaveClass('ng-cloak'); |
40 expect(element.hasClass('bar')).toBe(true); | 40 expect(element).toHaveClass('bar'); |
41 | 41 |
42 _.compile(element); | 42 _.compile(element); |
43 | 43 |
44 expect(element.hasClass('foo')).toBe(true); | 44 expect(element).toHaveClass('foo'); |
45 expect(element.hasClass('ng-cloak')).toBe(false); | 45 expect(element).not.toHaveClass('ng-cloak'); |
46 expect(element.hasClass('bar')).toBe(true); | 46 expect(element).toHaveClass('bar'); |
47 }); | 47 }); |
48 }); | 48 }); |
49 } | 49 } |
OLD | NEW |