| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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('ElementTest'); | 5 #library('ElementTest'); |
| 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 expectLargeRect(ClientRect rect) { | 10 expectLargeRect(ClientRect rect) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 Element makeElementWithChildren() => | 60 Element makeElementWithChildren() => |
| 61 new Element.html("<div><br/><img/><input/></div>"); | 61 new Element.html("<div><br/><img/><input/></div>"); |
| 62 | 62 |
| 63 test('computedStyle', () { | 63 test('computedStyle', () { |
| 64 final element = document.body; | 64 final element = document.body; |
| 65 element.computedStyle.then(expectAsync1((style) { | 65 element.computedStyle.then(expectAsync1((style) { |
| 66 Expect.equals(style.getPropertyValue('left'), 'auto'); | 66 Expect.equals(style.getPropertyValue('left'), 'auto'); |
| 67 })); | 67 })); |
| 68 }); | 68 }); |
| 69 | 69 |
| 70 test('rect', () { | |
| 71 final container = new Element.tag("div"); | |
| 72 container.style.position = 'absolute'; | |
| 73 container.style.top = '8px'; | |
| 74 container.style.left = '8px'; | |
| 75 final element = new Element.tag("div"); | |
| 76 element.style.width = '200px'; | |
| 77 element.style.height = '200px'; | |
| 78 container.elements.add(element); | |
| 79 document.body.elements.add(container); | |
| 80 | |
| 81 element.rect.then(expectAsync1((rect) { | |
| 82 expectLargeRect(rect.client); | |
| 83 expectLargeRect(rect.offset); | |
| 84 expectLargeRect(rect.scroll); | |
| 85 expect(rect.bounding.left, 8); | |
| 86 expect(rect.bounding.top, 8); | |
| 87 expect(rect.clientRects.length, greaterThan(0)); | |
| 88 container.remove(); | |
| 89 })); | |
| 90 }); | |
| 91 | |
| 92 test('client position synchronous', () { | 70 test('client position synchronous', () { |
| 93 final container = new Element.tag("div"); | 71 final container = new Element.tag("div"); |
| 94 container.style.position = 'absolute'; | 72 container.style.position = 'absolute'; |
| 95 container.style.top = '8px'; | 73 container.style.top = '8px'; |
| 96 container.style.left = '8px'; | 74 container.style.left = '8px'; |
| 97 final element = new Element.tag("div"); | 75 final element = new Element.tag("div"); |
| 98 element.style.width = '200px'; | 76 element.style.width = '200px'; |
| 99 element.style.height = '200px'; | 77 element.style.height = '200px'; |
| 100 container.elements.add(element); | 78 container.elements.add(element); |
| 101 document.body.elements.add(container); | 79 document.body.elements.add(container); |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 }); | 717 }); |
| 740 | 718 |
| 741 test('getRange', () { | 719 test('getRange', () { |
| 742 var range = makeElList().getRange(1, 2); | 720 var range = makeElList().getRange(1, 2); |
| 743 Expect.isTrue(range is List<Element>); | 721 Expect.isTrue(range is List<Element>); |
| 744 Expect.isTrue(range[0] is ImageElement); | 722 Expect.isTrue(range[0] is ImageElement); |
| 745 Expect.isTrue(range[1] is InputElement); | 723 Expect.isTrue(range[1] is InputElement); |
| 746 }); | 724 }); |
| 747 }); | 725 }); |
| 748 } | 726 } |
| OLD | NEW |