OLD | NEW |
(Empty) | |
| 1 'use strict'; |
| 2 |
| 3 function test_valid_value(property, value, serializedValue) { |
| 4 if (arguments.length < 3) |
| 5 serializedValue = value; |
| 6 |
| 7 var stringifiedValue = JSON.stringify(value); |
| 8 |
| 9 test(function(){ |
| 10 var div = document.createElement('div'); |
| 11 div.style[property] = value; |
| 12 assert_not_equals(div.style[property], ""); |
| 13 }, "e.style['" + property + "'] = " + stringifiedValue + " should set the pr
operty value"); |
| 14 |
| 15 test(function(){ |
| 16 var div = document.createElement('div'); |
| 17 div.style[property] = value; |
| 18 var readValue = div.style[property]; |
| 19 assert_equals(readValue, serializedValue); |
| 20 div.style[property] = readValue; |
| 21 assert_equals(div.style[property], readValue); |
| 22 }, "Serialization should round-trip after setting e.style['" + property + "'
] = " + stringifiedValue); |
| 23 } |
| 24 |
| 25 function test_invalid_value(property, value) { |
| 26 var stringifiedValue = JSON.stringify(value); |
| 27 |
| 28 test(function(){ |
| 29 var div = document.createElement('div'); |
| 30 div.style[property] = value; |
| 31 assert_equals(div.style[property], ""); |
| 32 }, "e.style['" + property + "'] = " + stringifiedValue + " should not set th
e property value"); |
| 33 } |
OLD | NEW |