| 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 layout_tests; | 5 library layout_tests; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 import '../../../swarm_ui_lib/base/base.dart'; | 10 import '../../../swarm_ui_lib/base/base.dart'; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 Future verifyGrid(String example, [Map expected = null]) { | 172 Future verifyGrid(String example, [Map expected = null]) { |
| 173 printMetrics(example); | 173 printMetrics(example); |
| 174 if (expected == null) { | 174 if (expected == null) { |
| 175 return new Future.value(); | 175 return new Future.value(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 for (String name in expected.keys) { | 178 for (String name in expected.keys) { |
| 179 final values = expected[name]; | 179 final values = expected[name]; |
| 180 final node = document.body.query('#$name'); | 180 final node = document.body.querySelector('#$name'); |
| 181 Expect.isNotNull(node); | 181 Expect.isNotNull(node); |
| 182 return new Future.value().then((_) { | 182 return new Future.value().then((_) { |
| 183 Expect.equals(values[0], node.offsetLeft); | 183 Expect.equals(values[0], node.offsetLeft); |
| 184 Expect.equals(values[1], node.offsetTop); | 184 Expect.equals(values[1], node.offsetTop); |
| 185 Expect.equals(values[2], node.offsetWidth); | 185 Expect.equals(values[2], node.offsetWidth); |
| 186 Expect.equals(values[3], node.offsetHeight); | 186 Expect.equals(values[3], node.offsetHeight); |
| 187 }); | 187 }); |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 Future verifyExample(String example, [Map expected = null]) { | 191 Future verifyExample(String example, [Map expected = null]) { |
| 192 return usingGrid(example, (grid) => verifyGrid(example, expected)); | 192 return usingGrid(example, (grid) => verifyGrid(example, expected)); |
| 193 } | 193 } |
| OLD | NEW |