Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #library('ShadowDOMTest'); | |
|
Siggi Cherem (dart-lang)
2012/06/25 22:16:00
+ copyright notice at the top
samhop
2012/06/26 00:19:15
Done.
| |
| 2 #import('../../lib/unittest/unittest.dart'); | |
| 3 #import('../../lib/unittest/html_config.dart'); | |
| 4 #import('dart:html'); | |
| 5 | |
| 6 main() { | |
| 7 useHtmlConfiguration(); | |
| 8 | |
| 9 test('Should be able to make a new ShadowRoot.', | |
| 10 () { | |
|
Siggi Cherem (dart-lang)
2012/06/25 22:16:00
style nit: move the '() {' to the previous line. T
samhop
2012/06/26 00:19:15
Done.
| |
| 11 var div1 = new DivElement(); | |
| 12 var sr = new ShadowRoot(div1); | |
| 13 document.body.nodes.add(div1); | |
| 14 expect(sr, isNotNull); | |
|
Jacob
2012/06/25 21:53:11
why would this be null?
samhop
2012/06/26 00:19:15
At one point I thought that was the failure behavi
| |
| 15 }); | |
| 16 | |
| 17 group('ShadowDOM tests', () { | |
| 18 | |
| 19 var div1, div2, sr; | |
| 20 | |
| 21 setUp(() { | |
| 22 div1 = new DivElement(); | |
| 23 div2 = new DivElement(); | |
| 24 div1.classes.add('foo'); | |
| 25 sr = new ShadowRoot(div2); | |
| 26 sr.nodes.add(new Element.html('<p class="foo"></p>')); | |
|
Jacob
2012/06/25 21:53:11
be consistent about creating elements using
Elemen
samhop
2012/06/26 00:19:15
Done.
| |
| 27 sr.nodes.add(new Element.tag('content')); | |
| 28 div2.nodes.add(new Element.html('<p class="foo"></p>')); | |
| 29 document.body.nodes.add(div1); | |
| 30 document.body.nodes.add(div2); | |
| 31 }); | |
| 32 | |
| 33 test(''' | |
| 34 nodes in a shadow DOM subtree are not accessible using selectors from | |
|
Jacob
2012/06/25 21:53:11
use a shorter test case name.
samhop
2012/06/26 00:19:15
Done.
| |
| 35 outside that shadow DOM subtree | |
| 36 ''', | |
| 37 () { | |
| 38 expect(queryAll('.foo').length, 2); | |
|
Siggi Cherem (dart-lang)
2012/06/25 22:16:00
it might be good to validate which elements are th
samhop
2012/06/26 00:19:15
Done.
| |
| 39 }); | |
| 40 | |
| 41 test('Parent node of a shadow root must be null.', | |
| 42 () { | |
|
Siggi Cherem (dart-lang)
2012/06/25 22:16:00
nit: join with prev line
samhop
2012/06/26 00:19:15
Done.
| |
| 43 sr = new ShadowRoot(div2); | |
| 44 expect(sr, isNotNull); | |
|
Jacob
2012/06/25 21:53:11
how is this testing that the parent node of a shad
samhop
2012/06/26 00:19:15
How embarrassing :p. Fixed.
On 2012/06/25 21:53:1
| |
| 45 }); | |
| 46 | |
| 47 | |
| 48 // TODO(samhop): test that <content> and <content select="foo"> and | |
| 49 // <shadow> | |
| 50 // work properly. This is blocked on having a good way to do browser | |
| 51 // rendering tests. | |
| 52 | |
| 53 test(''' | |
| 54 Querying on a selector from within a shadowed fragment does not return | |
| 55 elements outside the shadowed fragment (lower boundary is | |
| 56 encapsulated) and shadowed nodes are accessible by querying from | |
| 57 within the shadowed fragment. | |
|
Siggi Cherem (dart-lang)
2012/06/25 22:16:00
same comment from jacob here. Ideally a 1-line. If
samhop
2012/06/26 00:19:15
Done.
| |
| 58 ''', | |
| 59 () { | |
| 60 expect(sr.queryAll('.foo').length, 1); | |
|
Siggi Cherem (dart-lang)
2012/06/25 22:16:00
similarly to the other test: it would be good to c
samhop
2012/06/26 00:19:15
Done.
| |
| 61 }); | |
| 62 }); | |
| 63 } | |
| OLD | NEW |