OLD | NEW |
1 library DocumentTest; | |
2 import 'package:unittest/unittest.dart'; | |
3 import 'package:unittest/html_individual_config.dart'; | |
4 import 'dart:html'; | 1 import 'dart:html'; |
5 | 2 |
| 3 import 'package:minitest/minitest.dart'; |
| 4 |
6 main() { | 5 main() { |
7 useHtmlIndividualConfiguration(); | |
8 | |
9 var isElement = predicate((x) => x is Element, 'is an Element'); | 6 var isElement = predicate((x) => x is Element, 'is an Element'); |
10 var isDivElement = predicate((x) => x is DivElement, 'is a DivElement'); | 7 var isDivElement = predicate((x) => x is DivElement, 'is a DivElement'); |
11 var isAnchorElement = | 8 var isAnchorElement = |
12 predicate((x) => x is AnchorElement, 'is an AnchorElement'); | 9 predicate((x) => x is AnchorElement, 'is an AnchorElement'); |
13 var isUnknownElement = | 10 var isUnknownElement = |
14 predicate((x) => x is UnknownElement, 'is UnknownElement'); | 11 predicate((x) => x is UnknownElement, 'is UnknownElement'); |
15 | 12 |
16 var inscrutable; | 13 var inscrutable; |
17 | 14 |
18 test('CreateElement', () { | 15 test('CreateElement', () { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 expect(doc.adoptNode(div), div); | 49 expect(doc.adoptNode(div), div); |
53 expect(div.ownerDocument, doc); | 50 expect(div.ownerDocument, doc); |
54 doc.body.nodes.add(div); | 51 doc.body.nodes.add(div); |
55 expect(doc.query('#foo').text, 'bar'); | 52 expect(doc.query('#foo').text, 'bar'); |
56 }); | 53 }); |
57 | 54 |
58 test('importNode', () { | 55 test('importNode', () { |
59 var div = new Element.html('<div><div id="foo">bar</div></div>'); | 56 var div = new Element.html('<div><div id="foo">bar</div></div>'); |
60 var doc = document.implementation.createHtmlDocument(''); | 57 var doc = document.implementation.createHtmlDocument(''); |
61 var div2 = doc.importNode(div, true); | 58 var div2 = doc.importNode(div, true); |
62 expect(div2, isNot(equals(div))); | 59 expect(div2, notEquals(div)); |
63 expect(div2.ownerDocument, doc); | 60 expect(div2.ownerDocument, doc); |
64 doc.body.nodes.add(div2); | 61 doc.body.nodes.add(div2); |
65 expect(doc.query('#foo').text, 'bar'); | 62 expect(doc.query('#foo').text, 'bar'); |
66 }); | 63 }); |
67 | 64 |
68 test('typeTest1', () { | 65 test('typeTest1', () { |
69 inscrutable = inscrutable(inscrutable); | 66 inscrutable = inscrutable(inscrutable); |
70 var doc1 = document; | 67 var doc1 = document; |
71 expect(doc1 is HtmlDocument, true); | 68 expect(doc1 is HtmlDocument, true); |
72 expect(inscrutable(doc1) is HtmlDocument, true); | 69 expect(inscrutable(doc1) is HtmlDocument, true); |
73 var doc2 = document.implementation.createHtmlDocument(''); | 70 var doc2 = document.implementation.createHtmlDocument(''); |
74 expect(doc2 is HtmlDocument, true); | 71 expect(doc2 is HtmlDocument, true); |
75 expect(inscrutable(doc2) is HtmlDocument, true); | 72 expect(inscrutable(doc2) is HtmlDocument, true); |
76 }); | 73 }); |
77 | 74 |
78 test('typeTest2', () { | 75 test('typeTest2', () { |
79 inscrutable = inscrutable(inscrutable); | 76 inscrutable = inscrutable(inscrutable); |
80 // XML document. | 77 // XML document. |
81 var doc3 = document.implementation.createDocument(null, 'report', null); | 78 var doc3 = document.implementation.createDocument(null, 'report', null); |
82 expect(doc3 is HtmlDocument, false); | 79 expect(doc3 is HtmlDocument, false); |
83 expect(inscrutable(doc3) is HtmlDocument, false); | 80 expect(inscrutable(doc3) is HtmlDocument, false); |
84 }); | 81 }); |
85 }); | 82 }); |
86 } | 83 } |
OLD | NEW |