| 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 16 matching lines...) Expand all Loading... |
| 27 // These assertions throw a NotImplementedException in dartium: | 27 // These assertions throw a NotImplementedException in dartium: |
| 28 // Expect.isNull(style.parentRule); | 28 // Expect.isNull(style.parentRule); |
| 29 // Expect.isNull(style.getPropertyCSSValue('color')); | 29 // Expect.isNull(style.getPropertyCSSValue('color')); |
| 30 // Expect.isNull(style.getPropertyShorthand('color')); | 30 // Expect.isNull(style.getPropertyShorthand('color')); |
| 31 }); | 31 }); |
| 32 | 32 |
| 33 test('cssText is wrapped', () { | 33 test('cssText is wrapped', () { |
| 34 var style = createTestStyle(); | 34 var style = createTestStyle(); |
| 35 expect(style.cssText, | 35 expect(style.cssText, |
| 36 equals("color: blue; width: 2px !important; " | 36 equals("color: blue; width: 2px !important; " |
| 37 "-webkit-transform: rotate(90deg); ")); | 37 "-webkit-transform: rotate(90deg);")); |
| 38 style.cssText = "color: red"; | 38 style.cssText = "color: red"; |
| 39 expect(style.cssText, equals("color: red; ")); | 39 expect(style.cssText, equals("color: red;")); |
| 40 }); | 40 }); |
| 41 | 41 |
| 42 test('length is wrapped', () { | 42 test('length is wrapped', () { |
| 43 expect(createTestStyle(), hasLength(3)); | 43 expect(createTestStyle(), hasLength(3)); |
| 44 }); | 44 }); |
| 45 | 45 |
| 46 test('getPropertyPriority is wrapped', () { | 46 test('getPropertyPriority is wrapped', () { |
| 47 var style = createTestStyle(); | 47 var style = createTestStyle(); |
| 48 expect(style.getPropertyPriority("color"), isEmpty); | 48 expect(style.getPropertyPriority("color"), isEmpty); |
| 49 expect(style.getPropertyPriority("width"), equals("important")); | 49 expect(style.getPropertyPriority("width"), equals("important")); |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 test('item is wrapped', () { | 52 test('item is wrapped', () { |
| 53 var style = createTestStyle(); | 53 var style = createTestStyle(); |
| 54 expect(style.item(0), equals("color")); | 54 expect(style.item(0), equals("color")); |
| 55 expect(style.item(1), equals("width")); | 55 expect(style.item(1), equals("width")); |
| 56 expect(style.item(2), equals("-webkit-transform")); | 56 expect(style.item(2), equals("-webkit-transform")); |
| 57 }); | 57 }); |
| 58 | 58 |
| 59 test('removeProperty is wrapped', () { | 59 test('removeProperty is wrapped', () { |
| 60 var style = createTestStyle(); | 60 var style = createTestStyle(); |
| 61 style.removeProperty("width"); | 61 style.removeProperty("width"); |
| 62 expect(style.cssText, | 62 expect(style.cssText, |
| 63 equals("color: blue; -webkit-transform: rotate(90deg); ")); | 63 equals("color: blue; -webkit-transform: rotate(90deg);")); |
| 64 }); | 64 }); |
| 65 | 65 |
| 66 test('CSS property getters and setters', () { | 66 test('CSS property getters and setters', () { |
| 67 var style = createTestStyle(); | 67 var style = createTestStyle(); |
| 68 expect(style.color, equals("blue")); | 68 expect(style.color, equals("blue")); |
| 69 expect(style.width, equals("2px")); | 69 expect(style.width, equals("2px")); |
| 70 expect(style.transform, equals("rotate(90deg)")); | 70 expect(style.transform, equals("rotate(90deg)")); |
| 71 | 71 |
| 72 style.color = "red"; | 72 style.color = "red"; |
| 73 style.transform = "translate(10px, 20px)"; | 73 style.transform = "translate(10px, 20px)"; |
| 74 expect(style.cssText, | 74 expect(style.cssText, |
| 75 equals("color: red; width: 2px !important;" | 75 equals("color: red; width: 2px !important;" |
| 76 " -webkit-transform: translate(10px, 20px); ")); | 76 " -webkit-transform: translate(10px, 20px);")); |
| 77 }); | 77 }); |
| 78 } | 78 } |
| OLD | NEW |