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

Side by Side Diff: client/tests/client/html/CSSStyleDeclarationTests.dart

Issue 8392023: Code review fixes for CSSStyleDeclaration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « client/tests/client/client.status ('k') | client/tests/client/html/DocumentFragmentTests.dart » ('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 testCSSStyleDeclaration() { 5 testCSSStyleDeclaration() {
6 getStyle() { 6 createTestStyle() {
7 return new CSSStyleDeclaration.css(""" 7 return new CSSStyleDeclaration.css("""
8 color: blue; 8 color: blue;
9 width: 2px !important; 9 width: 2px !important;
10 -webkit-transform: rotate(90deg); 10 -webkit-transform: rotate(90deg);
11 """); 11 """);
12 }; 12 };
13 13
14 test('default constructor is empty', () { 14 test('default constructor is empty', () {
15 var style = new CSSStyleDeclaration(); 15 var style = new CSSStyleDeclaration();
16 Expect.equals("", style.cssText); 16 Expect.equals("", style.cssText);
17 Expect.equals("", style.getPropertyPriority('color')); 17 Expect.equals("", style.getPropertyPriority('color'));
18 Expect.equals("", style.item(0)); 18 Expect.equals("", style.item(0));
19 Expect.equals(0, style.length); 19 Expect.equals(0, style.length);
20 // These assertions throw a NotImplementedException in dartium:
20 // Expect.isNull(style.parentRule); 21 // Expect.isNull(style.parentRule);
21 // Expect.isNull(style.getPropertyCSSValue('color')); 22 // Expect.isNull(style.getPropertyCSSValue('color'));
22 // Expect.isNull(style.getPropertyShorthand('color')); 23 // Expect.isNull(style.getPropertyShorthand('color'));
23 }); 24 });
24 25
25 test('cssText is wrapped', () { 26 test('cssText is wrapped', () {
26 var style = getStyle(); 27 var style = createTestStyle();
27 Expect.equals( 28 Expect.equals(
28 "color: blue; width: 2px !important; -webkit-transform: rotate(90deg); ", 29 "color: blue; width: 2px !important; -webkit-transform: rotate(90deg); ",
29 style.cssText); 30 style.cssText);
30 style.cssText = "color: red"; 31 style.cssText = "color: red";
31 Expect.equals("color: red; ", style.cssText); 32 Expect.equals("color: red; ", style.cssText);
32 }); 33 });
33 34
34 test('length is wrapped', () { 35 test('length is wrapped', () {
35 Expect.equals(3, getStyle().length); 36 Expect.equals(3, createTestStyle().length);
36 }); 37 });
37 38
38 test('getPropertyPriority is wrapped', () { 39 test('getPropertyPriority is wrapped', () {
39 var style = getStyle(); 40 var style = createTestStyle();
40 Expect.equals("", style.getPropertyPriority("color")); 41 Expect.equals("", style.getPropertyPriority("color"));
41 Expect.equals("important", style.getPropertyPriority("width")); 42 Expect.equals("important", style.getPropertyPriority("width"));
42 }); 43 });
43 44
44 test('item is wrapped', () { 45 test('item is wrapped', () {
45 var style = getStyle(); 46 var style = createTestStyle();
46 Expect.equals("color", style.item(0)); 47 Expect.equals("color", style.item(0));
47 Expect.equals("width", style.item(1)); 48 Expect.equals("width", style.item(1));
48 Expect.equals("-webkit-transform", style.item(2)); 49 Expect.equals("-webkit-transform", style.item(2));
49 }); 50 });
50 51
51 test('removeProperty is wrapped', () { 52 test('removeProperty is wrapped', () {
52 var style = getStyle(); 53 var style = createTestStyle();
53 style.removeProperty("width"); 54 style.removeProperty("width");
54 Expect.equals( 55 Expect.equals(
55 "color: blue; -webkit-transform: rotate(90deg); ", 56 "color: blue; -webkit-transform: rotate(90deg); ",
56 style.cssText); 57 style.cssText);
57 }); 58 });
58 59
59 test('getters and setters are generated', () { 60 test('CSS property getters and setters', () {
60 var style = getStyle(); 61 var style = createTestStyle();
61 Expect.equals("blue", style.color); 62 Expect.equals("blue", style.color);
62 Expect.equals("2px", style.width); 63 Expect.equals("2px", style.width);
63 Expect.equals("rotate(90deg)", style.transform); 64 Expect.equals("rotate(90deg)", style.transform);
64 65
65 style.color = "red"; 66 style.color = "red";
66 style.transform = "translate(10px, 20px)"; 67 style.transform = "translate(10px, 20px)";
67 Expect.equals( 68 Expect.equals(
68 "width: 2px !important; color: red; -webkit-transform: translate(10px, 20p x); ", 69 "width: 2px !important; color: red; -webkit-transform: translate(10px, 20p x); ",
69 style.cssText); 70 style.cssText);
70 }); 71 });
71 } 72 }
OLDNEW
« no previous file with comments | « client/tests/client/client.status ('k') | client/tests/client/html/DocumentFragmentTests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698