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

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

Issue 17681003: Restore adoptNode and importNode to dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library DocumentTest; 1 library DocumentTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_individual_config.dart'; 3 import '../../pkg/unittest/lib/html_individual_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 5
6 main() { 6 main() {
7 useHtmlIndividualConfiguration(); 7 useHtmlIndividualConfiguration();
8 8
9 var isElement = predicate((x) => x is Element, 'is an Element'); 9 var isElement = predicate((x) => x is Element, 'is an Element');
10 var isDivElement = predicate((x) => x is DivElement, 'is a DivElement'); 10 var isDivElement = predicate((x) => x is DivElement, 'is a DivElement');
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 expect(rs, isNotNull); 54 expect(rs, isNotNull);
55 }); 55 });
56 56
57 test('CreateElement', () { 57 test('CreateElement', () {
58 // FIXME: nifty way crashes, do it boring way. 58 // FIXME: nifty way crashes, do it boring way.
59 expect(new Element.tag('span'), isElement); 59 expect(new Element.tag('span'), isElement);
60 expect(new Element.tag('div'), isDivElement); 60 expect(new Element.tag('div'), isDivElement);
61 expect(new Element.tag('a'), isAnchorElement); 61 expect(new Element.tag('a'), isAnchorElement);
62 expect(new Element.tag('bad_name'), isUnknownElement); 62 expect(new Element.tag('bad_name'), isUnknownElement);
63 }); 63 });
64
65 test('adoptNode', () {
66 var div = new Element.html('<div><div id="foo">bar</div></div>');
67 var doc = document.implementation.createHtmlDocument('');
68 expect(doc.adoptNode(div), div);
69 expect(div.document, doc);
70 doc.body.nodes.add(div);
71 expect(doc.query('#foo').text, 'bar');
72 });
73
74 test('importNode', () {
75 var div = new Element.html('<div><div id="foo">bar</div></div>');
76 var doc = document.implementation.createHtmlDocument('');
77 var div2 = doc.importNode(div, true);
78 expect(div2, isNot(equals(div)));
79 expect(div2.document, doc);
80 doc.body.nodes.add(div2);
81 expect(doc.query('#foo').text, 'bar');
82 });
64 }); 83 });
65 } 84 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698