| OLD | NEW |
| 1 library _specs_spec; | 1 library _specs_spec; |
| 2 | 2 |
| 3 import '_specs.dart'; | 3 import '_specs.dart'; |
| 4 | 4 |
| 5 main() { | 5 main() { |
| 6 describe('renderedText', () { | 6 describe('expect', () { |
| 7 it('should work on regular DOM nodes', () { | 7 describe('toHaveHtml', () { |
| 8 expect(renderedText($('<span>A<span>C</span></span><span>B</span>'))).toEq
ual('ACB'); | 8 it('should return html', (){ |
| 9 var div = es('<div>'); |
| 10 expect(es('<div>')).toHaveHtml(''); |
| 11 }); |
| 12 |
| 13 it('should strip ng-binding', () { |
| 14 var div = es('<div><span class="ng-binding"></span></div>'); |
| 15 expect(div).toHaveHtml('<span></span>'); |
| 16 }); |
| 9 }); | 17 }); |
| 10 | 18 |
| 11 it('should work with shadow DOM', () { | 19 describe('toHaveText', () { |
| 12 var elt = $('<div>DOM content</div>'); | 20 it('should work on regular DOM nodes', () { |
| 13 var shadow = elt[0].createShadowRoot(); | 21 expect(es('<span>A<span>C</span></span><span>B</span>')) |
| 14 shadow.setInnerHtml( | 22 .toHaveText('ACB'); |
| 15 '<div>Shadow content</div><content>SHADOW-CONTENT</content>', | |
| 16 treeSanitizer: new NullTreeSanitizer()); | |
| 17 expect(renderedText(elt)).toEqual('Shadow contentDOM content'); | |
| 18 }); | |
| 19 | |
| 20 it('should ignore comments', () { | |
| 21 expect(renderedText($('<!--e--><span>A<span>C</span></span><span>B</span>'
))).toEqual('ACB'); | |
| 22 }); | |
| 23 }); | |
| 24 | |
| 25 | |
| 26 describe('jquery', () { | |
| 27 describe('html', () { | |
| 28 it('get', (){ | |
| 29 var div = $('<div>'); | |
| 30 expect(div.html()).toEqual(''); | |
| 31 }); | 23 }); |
| 32 | 24 |
| 33 it('set', (){ | 25 it('should work with shadow DOM', () { |
| 34 var div = $('<div>'); | 26 var elt = e('<div>DOM content</div>'); |
| 35 expect(div.html('text')).toBe(div); | 27 var shadow = elt.createShadowRoot(); |
| 36 expect(div.html()).toEqual('text'); | 28 shadow.setInnerHtml( |
| 29 '<div>Shadow content</div><content></content>', |
| 30 treeSanitizer: new NullTreeSanitizer()); |
| 31 expect(elt).toHaveText('Shadow contentDOM content'); |
| 32 }); |
| 33 |
| 34 it('should work with shadow DOM even if content is not a direct child of s
hadow root', () { |
| 35 var elt = e('<div>DOM content</div>'); |
| 36 var shadow = elt.createShadowRoot(); |
| 37 shadow.setInnerHtml( |
| 38 '<div>Shadow content</div><span>:[<content></content>]</span>', |
| 39 treeSanitizer: new NullTreeSanitizer()); |
| 40 expect(elt).toHaveText('Shadow content:[DOM content]'); |
| 41 }); |
| 42 |
| 43 it('should ignore comments', () { |
| 44 expect(es('<!--e--><span>A<span>C</span></span><span>B</span>')) |
| 45 .toHaveText('ACB'); |
| 37 }); | 46 }); |
| 38 }); | 47 }); |
| 39 }); | 48 }); |
| 40 } | 49 } |
| OLD | NEW |