4 <style type=
"text/css">
5 /* Valid viewport syntax with no properties. */
9 /* Shorthands should be evaluated to the respective attributes. */
15 /* Shorthands with single value should assume this value for min and max. */
21 /* Shorthands should override properties if defined later. */
31 /* All valid properties with valid initial values. */
44 /* All valid properties with valid values. */
48 min-height: device-width
;
49 max-height: device-height
;
52 orientation: landscape
;
57 /* All valid properties with invalid initial values. Should be empty. */
61 min-height: landscape
;
70 /* Negative numbers should be dropped on zoom. */
77 /* Viewport attributes inside selectors should be dropped. */
86 /* Invalid attributes among valid should be dropped. */
88 font-family: sans-serif
;
89 min-width: device-width
;
90 max-width: device-height
;
97 orientation: portrait
;
101 letter-spacing: 0.5em;
104 <meta charset=
"utf-8" />
105 <link rel=
"help" href=
"http://www.w3.org/TR/css-device-adapt/#syntax" />
106 <script src=
"../../resources/testharness.js"></script>
107 <script src=
"../../resources/testharnessreport.js"></script>
108 <script type=
"text/javascript">
109 var rules
= document
.styleSheets
[0].cssRules
;
112 assert_equals(rules
.item(0).cssText
, "@viewport { }");
113 }, "Rule with no attributes");
116 assert_equals(rules
.item(1).cssText
,
118 " min-width: 400px;" +
119 " max-width: 500px;" +
120 " min-height: 200px;" +
121 " max-height: 300px; }");
122 }, "Shorthands with double value");
125 assert_equals(rules
.item(2).cssText
,
127 " min-width: 500px;" +
128 " max-width: 500px;" +
129 " min-height: 300px;" +
130 " max-height: 300px; }");
131 }, "Shorthands with single value");
134 assert_equals(rules
.item(3).cssText
,
136 " min-width: 500px;" +
137 " max-width: 500px;" +
138 " min-height: 300px;" +
139 " max-height: 300px; }");
140 }, "Shorthands should override properties if defined later");
143 assert_equals(rules
.item(4).cssText
,
145 " min-width: auto;" +
146 " max-width: auto;" +
147 " min-height: auto;" +
148 " max-height: auto;" +
151 " orientation: auto;" +
152 " user-zoom: zoom;" +
154 }, "All valid properties with valid intial values");
157 assert_equals(rules
.item(5).cssText
,
160 " max-width: 100px;" +
163 " orientation: landscape;" +
164 " user-zoom: fixed;" +
166 }, "All valid properties with valid values");
169 assert_equals(rules
.item(6).cssText
, "@viewport { }");
170 }, "All valid properties with invalid intial values");
173 assert_equals(rules
.item(7).cssText
, "@viewport { }");
174 }, "Negative numbers should be dropped on zoom attribute");
177 assert_equals(rules
.item(8).cssText
, ".foo { }");
178 }, "Viewport attributes inside selectors should be dropped");
181 assert_equals(rules
.item(9).cssText
,
183 " min-height: 500px;" +
184 " max-height: 50%;" +
187 " orientation: portrait;" +
188 " user-zoom: zoom;" +
190 }, "Invalid attributes among valid should be dropped");