| 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('../../lib/unittest/unittest.dart'); | 6 #import('../../lib/unittest/unittest.dart'); |
| 7 #import('../../lib/unittest/html_config.dart'); | 7 #import('../../lib/unittest/html_config.dart'); |
| 8 #import('dart:html'); | 8 #import('dart:html'); |
| 9 | 9 |
| 10 main() { | 10 main() { |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 }); | 521 }); |
| 522 | 522 |
| 523 test('beforeEnd inserts the HTML', () { | 523 test('beforeEnd inserts the HTML', () { |
| 524 final doc = getDoc(); | 524 final doc = getDoc(); |
| 525 doc.insertAdjacentHTML("beforeEnd", "<b/>foo"); | 525 doc.insertAdjacentHTML("beforeEnd", "<b/>foo"); |
| 526 Expect.equals("<a>foo</a><b></b>foo", doc.innerHTML); | 526 Expect.equals("<a>foo</a><b></b>foo", doc.innerHTML); |
| 527 }); | 527 }); |
| 528 }); | 528 }); |
| 529 | 529 |
| 530 group('default values', () { | 530 group('default values', () { |
| 531 asyncTest('default rect values', 1, () { | 531 test('default rect values', () { |
| 532 makeDocument().rect.then((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 callbackDone(); | 538 })); |
| 539 }); | |
| 540 }); | 539 }); |
| 541 | 540 |
| 542 test('nextElementSibling', () => | 541 test('nextElementSibling', () => |
| 543 Expect.isNull(makeDocument().nextElementSibling)); | 542 Expect.isNull(makeDocument().nextElementSibling)); |
| 544 test('previousElementSibling', () => | 543 test('previousElementSibling', () => |
| 545 Expect.isNull(makeDocument().previousElementSibling)); | 544 Expect.isNull(makeDocument().previousElementSibling)); |
| 546 test('parent', () => Expect.isNull(makeDocument().parent)); | 545 test('parent', () => Expect.isNull(makeDocument().parent)); |
| 547 test('offsetParent', () => Expect.isNull(makeDocument().offsetParent)); | 546 test('offsetParent', () => Expect.isNull(makeDocument().offsetParent)); |
| 548 test('activeElement', () => Expect.isNull(makeDocument().activeElement)); | 547 test('activeElement', () => Expect.isNull(makeDocument().activeElement)); |
| 549 test('body', () => Expect.isNull(makeDocument().body)); | 548 test('body', () => Expect.isNull(makeDocument().body)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 560 // | 559 // |
| 561 // test('charset', () => Expect.isNull(makeDocument().charset)); | 560 // test('charset', () => Expect.isNull(makeDocument().charset)); |
| 562 | 561 |
| 563 // TODO(nweiz): re-enable these when the WebKit-specificness won't break | 562 // TODO(nweiz): re-enable these when the WebKit-specificness won't break |
| 564 // non-WebKit browsers. | 563 // non-WebKit browsers. |
| 565 // | 564 // |
| 566 // test('webkitHidden', () => Expect.isFalse(makeDocument().webkitHidden)); | 565 // test('webkitHidden', () => Expect.isFalse(makeDocument().webkitHidden)); |
| 567 // test('webkitVisibilityState', () => | 566 // test('webkitVisibilityState', () => |
| 568 // Expect.equals('visible', makeDocument().webkitVisibilityState)); | 567 // Expect.equals('visible', makeDocument().webkitVisibilityState)); |
| 569 | 568 |
| 570 asyncTest('caretRangeFromPoint', 1, () { | 569 test('caretRangeFromPoint', () { |
| 571 final doc = makeDocument(); | 570 final doc = makeDocument(); |
| 572 Futures.wait([ | 571 Futures.wait([ |
| 573 doc.caretRangeFromPoint(), | 572 doc.caretRangeFromPoint(), |
| 574 doc.caretRangeFromPoint(0, 0), | 573 doc.caretRangeFromPoint(0, 0), |
| 575 doc.caretRangeFromPoint(5, 5) | 574 doc.caretRangeFromPoint(5, 5) |
| 576 ]).then((ranges) { | 575 ]).then(expectAsync1((ranges) { |
| 577 Expect.listEquals([null, null, null], ranges); | 576 Expect.listEquals([null, null, null], ranges); |
| 578 callbackDone(); | 577 })); |
| 579 }); | |
| 580 }); | 578 }); |
| 581 | 579 |
| 582 asyncTest('elementFromPoint', 1, () { | 580 test('elementFromPoint', () { |
| 583 final doc = makeDocument(); | 581 final doc = makeDocument(); |
| 584 Futures.wait([ | 582 Futures.wait([ |
| 585 doc.elementFromPoint(), | 583 doc.elementFromPoint(), |
| 586 doc.elementFromPoint(0, 0), | 584 doc.elementFromPoint(0, 0), |
| 587 doc.elementFromPoint(5, 5) | 585 doc.elementFromPoint(5, 5) |
| 588 ]).then((ranges) { | 586 ]).then(expectAsync1((ranges) { |
| 589 Expect.listEquals([null, null, null], ranges); | 587 Expect.listEquals([null, null, null], ranges); |
| 590 callbackDone(); | 588 })); |
| 591 }); | |
| 592 }); | 589 }); |
| 593 | 590 |
| 594 test('queryCommandEnabled', () { | 591 test('queryCommandEnabled', () { |
| 595 Expect.isFalse(makeDocument().queryCommandEnabled('foo')); | 592 Expect.isFalse(makeDocument().queryCommandEnabled('foo')); |
| 596 Expect.isFalse(makeDocument().queryCommandEnabled('bold')); | 593 Expect.isFalse(makeDocument().queryCommandEnabled('bold')); |
| 597 }); | 594 }); |
| 598 | 595 |
| 599 test('queryCommandIndeterm', () { | 596 test('queryCommandIndeterm', () { |
| 600 Expect.isFalse(makeDocument().queryCommandIndeterm('foo')); | 597 Expect.isFalse(makeDocument().queryCommandIndeterm('foo')); |
| 601 Expect.isFalse(makeDocument().queryCommandIndeterm('bold')); | 598 Expect.isFalse(makeDocument().queryCommandIndeterm('bold')); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 614 test('manifest', () => Expect.equals('', makeDocument().manifest)); | 611 test('manifest', () => Expect.equals('', makeDocument().manifest)); |
| 615 }); | 612 }); |
| 616 | 613 |
| 617 test('unsupported operations', () { | 614 test('unsupported operations', () { |
| 618 expectUnsupported(() { makeDocument().body = new XMLElement.tag('xml'); }); | 615 expectUnsupported(() { makeDocument().body = new XMLElement.tag('xml'); }); |
| 619 expectUnsupported(() => makeDocument().cookie); | 616 expectUnsupported(() => makeDocument().cookie); |
| 620 expectUnsupported(() { makeDocument().cookie = 'foo'; }); | 617 expectUnsupported(() { makeDocument().cookie = 'foo'; }); |
| 621 expectUnsupported(() { makeDocument().manifest = 'foo'; }); | 618 expectUnsupported(() { makeDocument().manifest = 'foo'; }); |
| 622 }); | 619 }); |
| 623 } | 620 } |
| OLD | NEW |