Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: tests/html/shadow_dom_test.dart

Issue 11642004: Revert "Cleaning up shadow dom tests." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library ShadowDOMTest; 5 library ShadowDOMTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_config.dart'; 7 import '../../pkg/unittest/lib/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 main() { 10 main() {
11 useHtmlConfiguration(); 11 useHtmlConfiguration();
12 12
13 group('ShadowDOM tests', () { 13 group('ShadowDOM tests', () {
14 14
15 var div1, div2, shadowRoot, paragraph1, paragraph2; 15 var div1, div2, shadowRoot, paragraph1, paragraph2;
16 16
17 void init() { 17 setUp(() {
18 paragraph1 = new ParagraphElement(); 18 paragraph1 = new ParagraphElement();
19 paragraph2 = new ParagraphElement(); 19 paragraph2 = new ParagraphElement();
20 [paragraph1, paragraph2].forEach((p) { p.classes.add('foo');}); 20 [paragraph1, paragraph2].forEach((p) { p.classes.add('foo');});
21 div1 = new DivElement(); 21 div1 = new DivElement();
22 div2 = new DivElement(); 22 div2 = new DivElement();
23 div1.classes.add('foo'); 23 div1.classes.add('foo');
24 shadowRoot = new ShadowRoot(div2); 24 shadowRoot = new ShadowRoot(div2);
25 shadowRoot.nodes.add(paragraph1); 25 shadowRoot.nodes.add(paragraph1);
26 // No constructor for ContentElement exists yet. 26 // No constructor for ContentElement exists yet.
27 // See http://code.google.com/p/dart/issues/detail?id=3870. 27 // See http://code.google.com/p/dart/issues/detail?id=3870.
28 shadowRoot.nodes.add(new Element.tag('content')); 28 shadowRoot.nodes.add(new Element.tag('content'));
29 div2.nodes.add(paragraph2); 29 div2.nodes.add(paragraph2);
30 document.body.nodes.add(div1); 30 document.body.nodes.add(div1);
31 document.body.nodes.add(div2); 31 document.body.nodes.add(div2);
32 } 32 });
33
34 var expectation = ShadowRoot.supported ? returnsNormally : throws;
35 33
36 test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () { 34 test("Shadowed nodes aren't visible to queries from outside ShadowDOM", () {
37 expect(() { 35 expect(queryAll('.foo'), equals([div1, paragraph2]));
38 init();
39
40 expect(queryAll('.foo'), equals([div1, paragraph2]));
41 }, expectation);
42 }); 36 });
43 37
44 test('Parent node of a shadow root must be null.', () { 38 test('Parent node of a shadow root must be null.', () {
45 expect(() { 39 expect(shadowRoot.parent, isNull);
46 init();
47
48 expect(shadowRoot.parent, isNull);
49 }, expectation);
50 }); 40 });
51 41
52 42
53 // TODO(samhop): test that <content> and <content select="foo"> and 43 // TODO(samhop): test that <content> and <content select="foo"> and
54 // <shadow> 44 // <shadow>
55 // work properly. This is blocked on having a good way to do browser 45 // work properly. This is blocked on having a good way to do browser
56 // rendering tests. 46 // rendering tests.
57 47
58 test('Querying in shadowed fragment respects the shadow boundary.', () { 48 test('Querying in shadowed fragment respects the shadow boundary.', () {
59 expect(() { 49 expect(shadowRoot.queryAll('.foo'), equals([paragraph1]));
60 init();
61
62 expect(shadowRoot.queryAll('.foo'), equals([paragraph1]));
63 }, expectation);
64 }); 50 });
65 }); 51 });
66 } 52 }
OLDNEW
« tests/html/shadow_dom_layout_test.dart ('K') | « tests/html/shadow_dom_layout_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698