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('XMLDocumentTest'); | 5 #library('XMLDocumentTest'); |
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 makeClassSet().every((c) => c.contains('a'))); | 114 makeClassSet().every((c) => c.contains('a'))); |
115 }); | 115 }); |
116 | 116 |
117 test('some', () { | 117 test('some', () { |
118 Expect.isTrue( | 118 Expect.isTrue( |
119 makeClassSet().some((c) => c.contains('a'))); | 119 makeClassSet().some((c) => c.contains('a'))); |
120 Expect.isFalse(makeClassSet().some((c) => c is num)); | 120 Expect.isFalse(makeClassSet().some((c) => c is num)); |
121 }); | 121 }); |
122 | 122 |
123 test('isEmpty', () { | 123 test('isEmpty', () { |
124 Expect.isFalse(makeClassSet().isEmpty()); | 124 Expect.isFalse(makeClassSet().isEmpty); |
125 Expect.isTrue(makeDocument().classes.isEmpty()); | 125 Expect.isTrue(makeDocument().classes.isEmpty); |
126 }); | 126 }); |
127 | 127 |
128 test('length', () { | 128 test('length', () { |
129 Expect.equals(3, makeClassSet().length); | 129 Expect.equals(3, makeClassSet().length); |
130 Expect.equals(0, makeDocument().classes.length); | 130 Expect.equals(0, makeDocument().classes.length); |
131 }); | 131 }); |
132 | 132 |
133 test('contains', () { | 133 test('contains', () { |
134 Expect.isTrue(makeClassSet().contains('foo')); | 134 Expect.isTrue(makeClassSet().contains('foo')); |
135 Expect.isFalse(makeClassSet().contains('qux')); | 135 Expect.isFalse(makeClassSet().contains('qux')); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 }); | 527 }); |
528 }); | 528 }); |
529 | 529 |
530 group('default values', () { | 530 group('default values', () { |
531 test('default rect values', () { | 531 test('default rect values', () { |
532 makeDocument().rect.then(expectAsync1((ElementRect rect) { | 532 makeDocument().rect.then(expectAsync1((ElementRect rect) { |
533 expectEmptyRect(rect.client); | 533 expectEmptyRect(rect.client); |
534 expectEmptyRect(rect.offset); | 534 expectEmptyRect(rect.offset); |
535 expectEmptyRect(rect.scroll); | 535 expectEmptyRect(rect.scroll); |
536 expectEmptyRect(rect.bounding); | 536 expectEmptyRect(rect.bounding); |
537 Expect.isTrue(rect.clientRects.isEmpty()); | 537 Expect.isTrue(rect.clientRects.isEmpty); |
538 })); | 538 })); |
539 }); | 539 }); |
540 | 540 |
541 test('nextElementSibling', () => | 541 test('nextElementSibling', () => |
542 Expect.isNull(makeDocument().nextElementSibling)); | 542 Expect.isNull(makeDocument().nextElementSibling)); |
543 test('previousElementSibling', () => | 543 test('previousElementSibling', () => |
544 Expect.isNull(makeDocument().previousElementSibling)); | 544 Expect.isNull(makeDocument().previousElementSibling)); |
545 test('parent', () => Expect.isNull(makeDocument().parent)); | 545 test('parent', () => Expect.isNull(makeDocument().parent)); |
546 test('offsetParent', () => Expect.isNull(makeDocument().offsetParent)); | 546 test('offsetParent', () => Expect.isNull(makeDocument().offsetParent)); |
547 test('activeElement', () => Expect.isNull(makeDocument().activeElement)); | 547 test('activeElement', () => Expect.isNull(makeDocument().activeElement)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 test('manifest', () => Expect.equals('', makeDocument().manifest)); | 611 test('manifest', () => Expect.equals('', makeDocument().manifest)); |
612 }); | 612 }); |
613 | 613 |
614 test('unsupported operations', () { | 614 test('unsupported operations', () { |
615 expectUnsupported(() { makeDocument().body = new XMLElement.tag('xml'); }); | 615 expectUnsupported(() { makeDocument().body = new XMLElement.tag('xml'); }); |
616 expectUnsupported(() => makeDocument().cookie); | 616 expectUnsupported(() => makeDocument().cookie); |
617 expectUnsupported(() { makeDocument().cookie = 'foo'; }); | 617 expectUnsupported(() { makeDocument().cookie = 'foo'; }); |
618 expectUnsupported(() { makeDocument().manifest = 'foo'; }); | 618 expectUnsupported(() { makeDocument().manifest = 'foo'; }); |
619 }); | 619 }); |
620 } | 620 } |
OLD | NEW |