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

Side by Side Diff: LayoutTests/fast/dom/css-element-attribute-js-null.html

Issue 107313004: Remove TreatNullAs=NullString for CSS*Rule (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 | « no previous file | LayoutTests/fast/dom/css-element-attribute-js-null-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <style type="text/css"> 3 <style type="text/css">
4 .pass { color: green; } 4 .pass { color: green; }
5 .fail { color: red; } 5 .fail { color: red; }
6 </style> 6 </style>
7 <style type="text/css"> 7 <style type="text/css">
8 .foo { color: black; } 8 .foo { color: black; }
9 @media screen { 9 @media screen {
10 .bar { color: blue; } 10 .bar { color: blue; }
11 } 11 }
12 </style> 12 @keyframes name { }
13 @page { }
14 </style>
15 <!-- @charset must be the first rule per spec, and additionally
16 with no leading whitespace per our parser. -->
17 <style>@charset "UTF-8";</style>
13 <script> 18 <script>
14 function printOut(msg) { 19 function printOut(msg) {
15 var console = document.getElementById("console"); 20 var console = document.getElementById("console");
16 var span = document.createElement('span'); 21 var span = document.createElement('span');
17 span.innerHTML = msg + '<br>'; 22 span.innerHTML = msg + '<br>';
18 console.appendChild(span); 23 console.appendChild(span);
19 } 24 }
20 25
21 function resultStringifier(result) 26 function resultStringifier(result)
22 { 27 {
(...skipping 17 matching lines...) Expand all
40 result = "<span class='fail'>TEST FAILED:</span> The value shoul d have been " + resultStringifier(expected) + " but was " + resultStringifier(el ement[attr]) + "."; 45 result = "<span class='fail'>TEST FAILED:</span> The value shoul d have been " + resultStringifier(expected) + " but was " + resultStringifier(el ement[attr]) + ".";
41 46
42 result += " [tested " + elementType + "." + attr + "]"; 47 result += " [tested " + elementType + "." + attr + "]";
43 printOut(result); 48 printOut(result);
44 } 49 }
45 50
46 function runTests() { 51 function runTests() {
47 if (window.testRunner) 52 if (window.testRunner)
48 testRunner.dumpAsText(); 53 testRunner.dumpAsText();
49 54
50 var rules = document.getElementsByTagName('style')[1].sheet.cssRules ; 55 var rules = document.styleSheets[1].cssRules;
51 56
52 var rule = rules.item(0); 57 var rule = rules[0];
58 var mediaRule = rules[1];
59 var keyframesRule = rules[2];
60 var pageRule = rules[3];
61 var charsetRule = document.styleSheets[2].cssRules[0];
53 var style = rule.style; 62 var style = rule.style;
54 var value = style.getPropertyCSSValue('color'); 63 var value = style.getPropertyCSSValue('color');
55 var mediaList = rules.item(1).media; 64 var mediaList = mediaRule.media;
56
57 65
58 var listing = [ 66 var listing = [
59 { 67 {
60 type: 'CSSRule', 68 type: 'CSSRule',
61 elementToUse: rule, 69 elementToUse: rule,
62 attributes: [ 70 attributes: [
63 // for now, setting cssText does not doing anything. Wh en it gets implemented, the expectedNull 71 // 'null' is not a valid rule, so the setter does nothi ng.
64 // should become the empty string.
65 {name: 'cssText', expectedNull: '.foo { color: black; }' } 72 {name: 'cssText', expectedNull: '.foo { color: black; }' }
66 ] 73 ]
67 }, 74 },
68 { 75 {
76 type: 'CSSCharsetRule',
77 elementToUse: charsetRule,
78 attributes: [
79 {name: 'encoding', expectedNull: 'null'}
80 ]
81 },
82 {
83 type: 'CSSKeyframesRule',
84 elementToUse: keyframesRule,
85 attributes: [
86 {name: 'name', expectedNull: 'null'}
87 ]
88 },
89 {
90 type: 'CSSPageRule',
91 elementToUse: pageRule,
92 attributes: [
93 {name: 'selectorText', expectedNull: '@page null'}
94 ]
95 },
96 {
69 type: 'CSSStyleRule', 97 type: 'CSSStyleRule',
70 elementToUse: rule, 98 elementToUse: rule,
71 attributes: [ 99 attributes: [
72 // for now, setting selectorText does not doing anythin g. When it gets implemented, the expectedNull 100 {name: 'selectorText', expectedNull: 'null'}
73 // should become the empty string.
74 {name: 'selectorText', expectedNull: '.foo'}
75 ] 101 ]
76 }, 102 },
77 { 103 {
78 type: 'CSSStyleDeclaration', 104 type: 'CSSStyleDeclaration',
79 elementToUse: style, 105 elementToUse: style,
80 attributes: [ 106 attributes: [
81 // cssText detects syntax errors, such as JS null, and s ets the value to the empty string. 107 // cssText detects syntax errors, such as JS null, and s ets the value to the empty string.
82 {name: 'cssText', expectedNull: ''} 108 {name: 'cssText', expectedNull: ''}
83 ] 109 ]
84 }, 110 },
85 { 111 {
86 type: 'CSSValue', 112 type: 'CSSValue',
87 elementToUse: value, 113 elementToUse: value,
88 attributes: [ 114 attributes: [
89 // for now, setting cssText does not doing anything. Whe n it gets implemented, the expectedNull 115 // for now, setting cssText does not doing anything. Whe n it gets implemented, the expectedNull
90 // should become the empty string. 116 // should become the empty string.
91 {name: 'cssText', expectedNull: 'black'} 117 {name: 'cssText', expectedNull: 'black'}
92 ] 118 ]
93 }, 119 },
94 { 120 {
95 type: 'MediaList', 121 type: 'MediaList',
96 elementToUse: mediaList, 122 elementToUse: mediaList,
97 attributes: [ 123 attributes: [
98 {name: 'mediaText', expectedNull: ''} 124 {name: 'mediaText', expectedNull: ''}
99 ] 125 ]
100 } 126 }
101 // ,{
102 // type: 'PageRule',
103 // elementToUse: mediaList,
104 // attributes: [
105 // {name: 'cssText', expectedNull: ''}
106 // ]
107 // }
108 ]; 127 ];
109 128
110 for (element in listing) { 129 for (element in listing) {
111 var type = listing[element].type; 130 var type = listing[element].type;
112 var elementToUse = listing[element].elementToUse; 131 var elementToUse = listing[element].elementToUse;
113 var attrs = listing[element].attributes; 132 var attrs = listing[element].attributes;
114 for (attr in attrs) { 133 for (attr in attrs) {
115 nullTestElementAttribute(type, elementToUse, attrs[attr].nam e, attrs[attr].expectedNull); 134 nullTestElementAttribute(type, elementToUse, attrs[attr].nam e, attrs[attr].expectedNull);
116 } 135 }
117 printOut(''); 136 printOut('');
118 } 137 }
119 } 138 }
120 </script> 139 </script>
121 </head> 140 </head>
122 <body onload="runTests()"> 141 <body onload="runTests()">
123 <p>This test setting various attributes of a CSSOM elements to JavaScript nu ll.</p> 142 <p>This test setting various attributes of a CSSOM elements to JavaScript nu ll.</p>
124 <div id="console"></div> 143 <div id="console"></div>
125 </body> 144 </body>
126 </html> 145 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/css-element-attribute-js-null-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698