Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library element_animate_test; | |
| 6 | |
| 7 import 'dart:async'; | |
| 8 import 'dart:html'; | |
| 9 import 'package:unittest/html_individual_config.dart'; | |
| 10 import 'package:unittest/unittest.dart'; | |
| 11 | |
| 12 main() { | |
| 13 useHtmlIndividualConfiguration(); | |
| 14 | |
| 15 group('animate_supported', () { | |
| 16 test('supported', () { | |
| 17 expect(Notification.supported, true); | |
| 18 }); | |
| 19 | |
| 20 test('simple timing', () { | |
| 21 var body = document.body; | |
| 22 var opacity = num.parse(body.getComputedStyle().opacity); | |
| 23 body.animate([{"opacity": 100}, {"opacity": 0}], 100); | |
| 24 var newOpacity = num.parse(body.getComputedStyle().opacity); | |
| 25 expect(newOpacity < opacity, isTrue); | |
| 26 }); | |
| 27 | |
| 28 test('timing dict', () { | |
| 29 var body = document.body; | |
| 30 // Animate different characteristics so the tests can run concurrently. | |
| 31 var fontSize = body.getComputedStyle().fontSize; | |
| 32 var player = body.animate( | |
| 33 [{"font-size": "500px"}, {"font-size": fontSize}], | |
| 34 {"duration": 100}); | |
| 35 var newFontSize = body.getComputedStyle().fontSize; | |
| 36 // Don't bother to parse to numbers, as long as it's changed that | |
| 37 // indicates something is happening. | |
| 38 expect(newFontSize == fontSize, isFalse); | |
| 39 player.on['finish'].listen(expectAsync((_) => 'done')); | |
| 40 }); | |
| 41 | |
| 42 test('omit timing', () { | |
| 43 var body = document.body; | |
| 44 var player = body.animate([ | |
| 45 {"transform": "translate(100px, -100%)"}, | |
| 46 {"transform": "translate(400px, 500px)"} | |
| 47 ]); | |
| 48 player.on['finish'].listen(expectAsync((_) => 'done')); | |
| 49 }); | |
| 50 }); | |
| 51 } | |
|
terry
2015/03/19 17:03:15
Should we have a test where the dictionary fails e
Alan Knight
2015/03/23 18:57:52
It would be nice if they did, but Chrome happily a
| |
| OLD | NEW |