OLD | NEW |
| (Empty) |
1 window.expect = (function() { | |
2 var testElement = document.getElementById('target'); | |
3 | |
4 function assert_equals_or_matches(actual, expected, description) { | |
5 return expected instanceof RegExp ? | |
6 assert_regexp_match(actual, expected, description) : | |
7 assert_equals(actual, expected, description); | |
8 } | |
9 return function expect(property, camelProperty, input) { | |
10 return { | |
11 parsesAs: function(output) { | |
12 test(function() { | |
13 assert_true(CSS.supports(property, input), 'CSS.supports'); | |
14 testElement.style[camelProperty] = input; | |
15 assert_equals(testElement.style[camelProperty], output); | |
16 }, '"' + property + ': ' + input + ';" should parse as "' + output + '"'
); | |
17 return this; | |
18 }, | |
19 isComputedTo: function(output) { | |
20 test(function() { | |
21 testElement.style[camelProperty] = input; | |
22 assert_equals_or_matches(getComputedStyle(testElement)[camelProperty],
output); | |
23 }, '"' + property + ': ' + input + ';" should be computed to "' + output
+ '"'); | |
24 }, | |
25 isInvalid: function() { | |
26 test(function() { | |
27 assert_false(CSS.supports(property, input), 'CSS.supports'); | |
28 }, '"' + property + ': ' + input + ';" should be invalid'); | |
29 }, | |
30 }; | |
31 } | |
32 })(); | |
OLD | NEW |