Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/typedcssom/inlinestyle/tokenStreamValue.html |
| diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/tokenStreamValue.html b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/tokenStreamValue.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9c4df48c809c6f19899ae30aeb3ed4bd7b331474 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/tokenStreamValue.html |
| @@ -0,0 +1,47 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| + |
| +<div id="testElement"></div> |
| + |
| +<script> |
| + |
| +test(function() { |
| + testElement.style.width = "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))"; |
| + var result = [...testElement.styleMap.get('width')]; |
| + assert_equals(result.length, 5); |
| + assert_equals(result[0], "calc(42px + "); |
|
meade_UTC10
2016/08/26 01:29:22
You seem to be missing a bracket? Don't forget to
anthonyhkf
2016/08/26 03:10:28
Hmm? I think the brackets match?
meade_UTC10
2016/08/26 03:18:57
So they do! The extra bracket is in the string. My
|
| + assert_equals(result[1].variable, "--foo"); |
| + assert_equals([...result[1].fallback].length, 1); |
| + assert_equals([...result[1].fallback][0], " 15em"); |
| + assert_equals(result[2], " + "); |
| + assert_equals(result[3].variable, "--bar"); |
| + var result_3 = [...result[3].fallback]; |
|
meade_UTC10
2016/08/26 01:29:22
How about a more descriptive variable name like "b
anthonyhkf
2016/08/26 03:10:28
Done.
|
| + assert_equals(result_3.length, 3); |
| + assert_equals(result_3[0], " "); |
| + assert_equals(result_3[1].variable, "--far"); |
| + assert_equals(result_3[1].fallback, null); |
| + assert_equals(result_3[2], " + 15px"); |
| + assert_equals(result[4], ")"); |
| +}, "Construction of CSSTokenStreamValue is normalized using example from the spec"); |
| + |
| +test(function() { |
| + testElement.style.width = "var(--a, 10px, 20px, 30em)"; |
| + var result = [...testElement.styleMap.get('width')]; |
| + assert_equals(result.length, 1); |
| + assert_equals(result[0].variable, "--a"); |
| + assert_equals([...result[0].fallback].length, 1); |
| + assert_equals([...result[0].fallback][0], " 10px, 20px, 30em"); |
| +}, "Has several values"); |
| + |
| +test(function() { |
| + testElement.style.width = " var( --a , 5px ) "; |
|
meade_UTC10
2016/08/26 01:29:22
You should also test "calc( var( --far , 30px ) +
anthonyhkf
2016/08/26 03:10:28
Done.
|
| + var result = [...testElement.styleMap.get('width')]; |
| + assert_equals(result.length, 2); |
| + assert_equals(result[0].variable, "--a"); |
| + assert_equals([...result[0].fallback].length, 1); |
| + assert_equals([...result[0].fallback][0], " 5px "); |
| + assert_equals(result[1], " "); |
| +}, "Can handle extra spaces"); |
| + |
| +</script> |