Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Side by Side Diff: tests/html/cssstyledeclaration_test.dart

Issue 10905130: Adding IE support to browser prefixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removing test exceptions from html.status. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/html/src/Device.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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() {
11 useHtmlConfiguration(); 11 useHtmlConfiguration();
12 12
13 createTestStyle() { 13 createTestStyle() {
14 return new CSSStyleDeclaration.css(""" 14 return new CSSStyleDeclaration.css("""
15 color: blue; 15 color: blue;
16 width: 2px !important; 16 width: 2px !important;
17 -webkit-transform: rotate(90deg);
18 """); 17 """);
19 }; 18 };
20 19
21 test('default constructor is empty', () { 20 test('default constructor is empty', () {
22 var style = new CSSStyleDeclaration(); 21 var style = new CSSStyleDeclaration();
23 expect(style.cssText, isEmpty); 22 expect(style.cssText, isEmpty);
24 expect(style.getPropertyPriority('color'), isEmpty); 23 expect(style.getPropertyPriority('color'), isEmpty);
25 expect(style.item(0), isEmpty); 24 expect(style.item(0), isEmpty);
26 expect(style, hasLength(0)); 25 expect(style, hasLength(0));
27 // These assertions throw a NotImplementedException in dartium: 26 // These assertions throw a NotImplementedException in dartium:
28 // Expect.isNull(style.parentRule); 27 // Expect.isNull(style.parentRule);
29 // Expect.isNull(style.getPropertyCSSValue('color')); 28 // Expect.isNull(style.getPropertyCSSValue('color'));
30 // Expect.isNull(style.getPropertyShorthand('color')); 29 // Expect.isNull(style.getPropertyShorthand('color'));
31 }); 30 });
32 31
33 test('cssText is wrapped', () {
34 var style = createTestStyle();
35 expect(style.cssText,
36 equals("color: blue; width: 2px !important; "
37 "-webkit-transform: rotate(90deg);"));
38 style.cssText = "color: red";
39 expect(style.cssText, equals("color: red;"));
40 });
41
42 test('length is wrapped', () { 32 test('length is wrapped', () {
43 expect(createTestStyle(), hasLength(3)); 33 expect(createTestStyle(), hasLength(2));
44 }); 34 });
45 35
46 test('getPropertyPriority is wrapped', () { 36 test('getPropertyPriority is wrapped', () {
47 var style = createTestStyle(); 37 var style = createTestStyle();
48 expect(style.getPropertyPriority("color"), isEmpty); 38 expect(style.getPropertyPriority("color"), isEmpty);
49 expect(style.getPropertyPriority("width"), equals("important")); 39 expect(style.getPropertyPriority("width"), equals("important"));
50 }); 40 });
51 41
52 test('item is wrapped', () {
53 var style = createTestStyle();
54 expect(style.item(0), equals("color"));
55 expect(style.item(1), equals("width"));
56 expect(style.item(2), equals("-webkit-transform"));
57 });
58
59 test('removeProperty is wrapped', () { 42 test('removeProperty is wrapped', () {
60 var style = createTestStyle(); 43 var style = createTestStyle();
61 style.removeProperty("width"); 44 style.removeProperty("width");
62 expect(style.cssText, 45 expect(style.cssText.trim(),
63 equals("color: blue; -webkit-transform: rotate(90deg);")); 46 equals("color: blue;"));
64 }); 47 });
65 48
66 test('CSS property getters and setters', () { 49 test('CSS property getters and setters', () {
67 var style = createTestStyle(); 50 var style = createTestStyle();
68 expect(style.color, equals("blue")); 51 expect(style.color, equals("blue"));
69 expect(style.width, equals("2px")); 52 expect(style.width, equals("2px"));
70 expect(style.transform, equals("rotate(90deg)"));
71 53
72 style.color = "red"; 54 style.color = "red";
73 style.transform = "translate(10px, 20px)"; 55 style.transform = "translate(10px, 20px)";
74 expect(style.cssText, 56
75 equals("color: red; width: 2px !important;" 57 expect(style.color, equals("red"));
76 " -webkit-transform: translate(10px, 20px);")); 58 expect(style.transform, equals("translate(10px, 20px)"));
59 });
60
61 test('Browser prefixes', () {
62 var element = new DivElement();
63 element.style.transform = 'translateX(10px)';
64 document.body.elements.add(element);
65
66 var style = new CSSStyleDeclaration();
67
68 element.getComputedStyle('').then(expectAsync1(
69 (CSSStyleDeclaration style) {
70 // 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.
72 expect(style.transform.length, greaterThan(3));
73 }
74 ));
77 }); 75 });
78 } 76 }
OLDNEW
« no previous file with comments | « lib/html/src/Device.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698