Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: tests/html/element_test.dart

Issue 18060010: Added offset document measurement to Element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart'; 7 import '../../pkg/unittest/lib/html_individual_config.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 test('computedStyle', () { 52 test('computedStyle', () {
53 final element = document.body; 53 final element = document.body;
54 var style = element.getComputedStyle(); 54 var style = element.getComputedStyle();
55 expect(style.getPropertyValue('left'), 'auto'); 55 expect(style.getPropertyValue('left'), 'auto');
56 }); 56 });
57 57
58 test('client position synchronous', () { 58 test('client position synchronous', () {
59 final container = new Element.tag("div"); 59 final container = new Element.tag("div");
60 container.style.position = 'absolute'; 60 container.style.position = 'absolute';
61 container.style.top = '8px'; 61 container.style.top = '8px';
62 container.style.left = '8px'; 62 container.style.left = '9px';
63 final element = new Element.tag("div"); 63 final element = new Element.tag("div");
64 element.style.width = '200px'; 64 element.style.width = '200px';
65 element.style.height = '200px'; 65 element.style.height = '200px';
66 container.children.add(element); 66 container.children.add(element);
67 document.body.children.add(container); 67 document.body.children.add(container);
68 68
69 expect(element.client.width, greaterThan(100)); 69 expect(element.client.width, greaterThan(100));
70 expect(element.client.height, greaterThan(100)); 70 expect(element.client.height, greaterThan(100));
71 expect(element.offset.width, greaterThan(100)); 71 expect(element.offset.width, greaterThan(100));
72 expect(element.offset.height, greaterThan(100)); 72 expect(element.offset.height, greaterThan(100));
73 expect(element.scrollWidth, greaterThan(100)); 73 expect(element.scrollWidth, greaterThan(100));
74 expect(element.scrollHeight, greaterThan(100)); 74 expect(element.scrollHeight, greaterThan(100));
75 expect(element.getBoundingClientRect().left, 8); 75 expect(element.getBoundingClientRect().left, 9);
76 expect(element.getBoundingClientRect().top, 8); 76 expect(element.getBoundingClientRect().top, 8);
77
78 expect(element.documentOffset.x, 9);
79 expect(element.documentOffset.y, 8);
77 container.remove(); 80 container.remove();
78 }); 81 });
79 }); 82 });
80 83
81 group('constructors', () { 84 group('constructors', () {
82 test('error', () { 85 test('error', () {
83 expect(() => new Element.html('<br/><br/>'), throwsArgumentError); 86 expect(() => new Element.html('<br/><br/>'), throwsArgumentError);
84 }); 87 });
85 88
86 test('.html has no parent', () => 89 test('.html has no parent', () =>
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 }); 722 });
720 723
721 test('sublist', () { 724 test('sublist', () {
722 var range = makeElList().sublist(1, 3); 725 var range = makeElList().sublist(1, 3);
723 expect(range, isElementList); 726 expect(range, isElementList);
724 expect(range[0], isImageElement); 727 expect(range[0], isImageElement);
725 expect(range[1], isInputElement); 728 expect(range[1], isInputElement);
726 }); 729 });
727 }); 730 });
728 } 731 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698