| 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('CSSStyleDeclarationTest'); | 5 #library('CSSStyleDeclarationTest'); |
| 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 main() { | 10 main() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 expect(style.color, equals("red")); | 57 expect(style.color, equals("red")); |
| 58 expect(style.transform, equals("translate(10px, 20px)")); | 58 expect(style.transform, equals("translate(10px, 20px)")); |
| 59 }); | 59 }); |
| 60 | 60 |
| 61 test('Browser prefixes', () { | 61 test('Browser prefixes', () { |
| 62 var element = new DivElement(); | 62 var element = new DivElement(); |
| 63 element.style.transform = 'translateX(10px)'; | 63 element.style.transform = 'translateX(10px)'; |
| 64 document.body.elements.add(element); | 64 document.body.elements.add(element); |
| 65 | 65 |
| 66 var style = new CSSStyleDeclaration(); | |
| 67 | |
| 68 element.getComputedStyle('').then(expectAsync1( | 66 element.getComputedStyle('').then(expectAsync1( |
| 69 (CSSStyleDeclaration style) { | 67 (CSSStyleDeclaration style) { |
| 70 // Some browsers will normalize this, so it'll be a matrix rather than | 68 // Some browsers will normalize this, so it'll be a matrix rather than |
| 71 // the original string. Just check that it's something other than null. | 69 // the original string. Just check that it's something other than null. |
| 72 expect(style.transform.length, greaterThan(3)); | 70 expect(style.transform.length, greaterThan(3)); |
| 73 } | 71 } |
| 74 )); | 72 )); |
| 75 }); | 73 }); |
| 74 |
| 75 // IE9 requires an extra poke for some properties to get applied. |
| 76 test('IE9 Invalidation', () { |
| 77 var element = new DivElement(); |
| 78 document.body.elements.add(element); |
| 79 |
| 80 // Need to wait one tick after the element has been added to the page. |
| 81 window.setTimeout(expectAsync0(() { |
| 82 element.style.textDecoration = 'underline'; |
| 83 element.getComputedStyle('').then(expectAsync1( |
| 84 (CSSStyleDeclaration style) { |
| 85 expect(style.textDecoration, equals('underline')); |
| 86 } |
| 87 )); |
| 88 }), 10); |
| 89 }); |
| 76 } | 90 } |
| OLD | NEW |