OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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('XMLElementTest'); | 5 #library('XMLElementTest'); |
6 #import('../../pkg/unittest/unittest.dart'); | 6 #import('../../pkg/unittest/unittest.dart'); |
7 #import('../../pkg/unittest/html_config.dart'); | 7 #import('../../pkg/unittest/html_config.dart'); |
8 #import('dart:html'); | 8 #import('dart:html'); |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 11 matching lines...) Expand all Loading... |
22 group('.xml', () { | 22 group('.xml', () { |
23 test('with a well-formed document', () { | 23 test('with a well-formed document', () { |
24 final el = makeElement(); | 24 final el = makeElement(); |
25 Expect.isTrue(el is XMLElement); | 25 Expect.isTrue(el is XMLElement); |
26 Expect.equals('foo', el.elements[0].tagName); | 26 Expect.equals('foo', el.elements[0].tagName); |
27 Expect.equals('bar', el.elements[1].tagName); | 27 Expect.equals('bar', el.elements[1].tagName); |
28 }); | 28 }); |
29 | 29 |
30 test('with too many nodes', () { | 30 test('with too many nodes', () { |
31 Expect.throws(() => new XMLElement.xml("<xml></xml>foo"), | 31 Expect.throws(() => new XMLElement.xml("<xml></xml>foo"), |
32 (e) => e is IllegalArgumentException); | 32 (e) => e is ArgumentError); |
33 }); | 33 }); |
34 | 34 |
35 test('with a parse error', () { | 35 test('with a parse error', () { |
36 Expect.throws(() => new XMLElement.xml("<xml></xml>>"), | 36 Expect.throws(() => new XMLElement.xml("<xml></xml>>"), |
37 (e) => e is IllegalArgumentException); | 37 (e) => e is ArgumentError); |
38 }); | 38 }); |
39 | 39 |
40 test('with a PARSERERROR tag', () { | 40 test('with a PARSERERROR tag', () { |
41 final el = new XMLElement.xml("<xml><parsererror /></xml>"); | 41 final el = new XMLElement.xml("<xml><parsererror /></xml>"); |
42 Expect.equals('parsererror', el.elements[0].tagName); | 42 Expect.equals('parsererror', el.elements[0].tagName); |
43 }); | 43 }); |
44 | 44 |
45 test('has no parent', () => | 45 test('has no parent', () => |
46 Expect.isNull(new XMLElement.xml('<foo/>').parent)); | 46 Expect.isNull(new XMLElement.xml('<foo/>').parent)); |
47 }); | 47 }); |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 makeElement().rect.then( | 567 makeElement().rect.then( |
568 expectAsync1(ElementRect rect) { | 568 expectAsync1(ElementRect rect) { |
569 expectEmptyRect(rect.client); | 569 expectEmptyRect(rect.client); |
570 expectEmptyRect(rect.offset); | 570 expectEmptyRect(rect.offset); |
571 expectEmptyRect(rect.scroll); | 571 expectEmptyRect(rect.scroll); |
572 expectEmptyRect(rect.bounding); | 572 expectEmptyRect(rect.bounding); |
573 Expect.isTrue(rect.clientRects.isEmpty()); | 573 Expect.isTrue(rect.clientRects.isEmpty()); |
574 })); | 574 })); |
575 }); | 575 }); |
576 } | 576 } |
OLD | NEW |