| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library iron_elements.test.mock_interactions; | 4 library iron_elements.test.mock_interactions; |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'dart:js'; | 8 import 'dart:js'; |
| 9 import 'package:polymer_elements/iron_test_helpers.dart' as test_helpers; | 9 import 'package:polymer_elements/iron_test_helpers.dart' as test_helpers; |
| 10 | 10 |
| 11 /// Used imports: [test_helpers] | 11 /// Used imports: [test_helpers] |
| 12 final JsObject _MockInteractionsJs = context['MockInteractions']; | 12 final JsObject _MockInteractionsJs = context['MockInteractions']; |
| 13 | 13 |
| 14 class Point { | 14 class Point { |
| 15 num x; | 15 num x; |
| 16 num y; | 16 num y; |
| 17 | 17 |
| 18 Point(this.x, this.y); |
| 19 |
| 18 Point.fromJsObject(JsObject object) | 20 Point.fromJsObject(JsObject object) |
| 19 : x = object['x'], | 21 : x = object['x'], |
| 20 y = object['y']; | 22 y = object['y']; |
| 21 | 23 |
| 22 Map toMap() => {'x': x, 'y': y}; | 24 Map toMap() => {'x': x, 'y': y}; |
| 23 JsObject toJsObject() => new JsObject.jsify(toMap()); | 25 JsObject toJsObject() => new JsObject.jsify(toMap()); |
| 24 | 26 |
| 25 bool isApproximatelyEqualTo(other) { | 27 bool isApproximatelyEqualTo(other) { |
| 26 return this.x.round() == other.x.round() && | 28 return this.x.round() == other.x.round() && |
| 27 this.y.round() == other.y.round(); | 29 this.y.round() == other.y.round(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 155 |
| 154 Future requestAnimationFrame() { | 156 Future requestAnimationFrame() { |
| 155 var completer = new Completer(); | 157 var completer = new Completer(); |
| 156 window.requestAnimationFrame((done) { | 158 window.requestAnimationFrame((done) { |
| 157 completer.complete(); | 159 completer.complete(); |
| 158 }); | 160 }); |
| 159 return completer.future; | 161 return completer.future; |
| 160 } | 162 } |
| 161 | 163 |
| 162 List keysOf(JsObject object) => context['Object'].callMethod('keys', [object]); | 164 List keysOf(JsObject object) => context['Object'].callMethod('keys', [object]); |
| 165 |
| OLD | NEW |