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 void testXMLDocument() { | 5 void testXMLDocument() { |
6 XMLDocument makeDocument() => new XMLDocument.xml("<xml><foo/><bar/></xml>"); | 6 XMLDocument makeDocument() => new XMLDocument.xml("<xml><foo/><bar/></xml>"); |
7 | 7 |
8 group('constructor', () { | 8 group('constructor', () { |
9 test('with a well-formed document', () { | 9 test('with a well-formed document', () { |
10 final doc = makeDocument(); | 10 final doc = makeDocument(); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 }); | 533 }); |
534 | 534 |
535 test('nextElementSibling', () => | 535 test('nextElementSibling', () => |
536 Expect.isNull(makeDocument().nextElementSibling)); | 536 Expect.isNull(makeDocument().nextElementSibling)); |
537 test('previousElementSibling', () => | 537 test('previousElementSibling', () => |
538 Expect.isNull(makeDocument().previousElementSibling)); | 538 Expect.isNull(makeDocument().previousElementSibling)); |
539 test('parent', () => Expect.isNull(makeDocument().parent)); | 539 test('parent', () => Expect.isNull(makeDocument().parent)); |
540 test('offsetParent', () => Expect.isNull(makeDocument().offsetParent)); | 540 test('offsetParent', () => Expect.isNull(makeDocument().offsetParent)); |
541 test('activeElement', () => Expect.isNull(makeDocument().activeElement)); | 541 test('activeElement', () => Expect.isNull(makeDocument().activeElement)); |
542 test('body', () => Expect.isNull(makeDocument().body)); | 542 test('body', () => Expect.isNull(makeDocument().body)); |
543 test('charset', () => Expect.isNull(makeDocument().charset)); | |
544 test('window', () => Expect.isNull(makeDocument().window)); | 543 test('window', () => Expect.isNull(makeDocument().window)); |
545 test('domain', () => Expect.equals('', makeDocument().domain)); | 544 test('domain', () => Expect.equals('', makeDocument().domain)); |
546 test('head', () => Expect.isNull(makeDocument().head)); | 545 test('head', () => Expect.isNull(makeDocument().head)); |
547 test('referrer', () => Expect.equals('', makeDocument().referrer)); | 546 test('referrer', () => Expect.equals('', makeDocument().referrer)); |
548 test('styleSheets', () => | 547 test('styleSheets', () => |
549 Expect.listEquals([], makeDocument().styleSheets)); | 548 Expect.listEquals([], makeDocument().styleSheets)); |
550 test('title', () => Expect.equals('', makeDocument().title)); | 549 test('title', () => Expect.equals('', makeDocument().title)); |
551 | 550 |
| 551 // TODO(nweiz): IE sets the charset to "windows-1252". How do we want to |
| 552 // handle that? |
| 553 // |
| 554 // test('charset', () => Expect.isNull(makeDocument().charset)); |
| 555 |
552 // TODO(nweiz): re-enable these when the WebKit-specificness won't break | 556 // TODO(nweiz): re-enable these when the WebKit-specificness won't break |
553 // non-WebKit browsers. | 557 // non-WebKit browsers. |
554 // | 558 // |
555 // test('webkitHidden', () => Expect.isFalse(makeDocument().webkitHidden)); | 559 // test('webkitHidden', () => Expect.isFalse(makeDocument().webkitHidden)); |
556 // test('webkitVisibilityState', () => | 560 // test('webkitVisibilityState', () => |
557 // Expect.equals('visible', makeDocument().webkitVisibilityState)); | 561 // Expect.equals('visible', makeDocument().webkitVisibilityState)); |
558 | 562 |
559 asyncTest('caretRangeFromPoint', 1, () { | 563 asyncTest('caretRangeFromPoint', 1, () { |
560 final doc = makeDocument(); | 564 final doc = makeDocument(); |
561 Futures.wait([ | 565 Futures.wait([ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 test('manifest', () => Expect.equals('', makeDocument().manifest)); | 607 test('manifest', () => Expect.equals('', makeDocument().manifest)); |
604 }); | 608 }); |
605 | 609 |
606 test('unsupported operations', () { | 610 test('unsupported operations', () { |
607 expectUnsupported(() { makeDocument().body = new XMLElement.tag('xml'); }); | 611 expectUnsupported(() { makeDocument().body = new XMLElement.tag('xml'); }); |
608 expectUnsupported(() => makeDocument().cookie); | 612 expectUnsupported(() => makeDocument().cookie); |
609 expectUnsupported(() { makeDocument().cookie = 'foo'; }); | 613 expectUnsupported(() { makeDocument().cookie = 'foo'; }); |
610 expectUnsupported(() { makeDocument().manifest = 'foo'; }); | 614 expectUnsupported(() { makeDocument().manifest = 'foo'; }); |
611 }); | 615 }); |
612 } | 616 } |
OLD | NEW |