Commit 4417ec92 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

[css-typed-om] Add more property tests.

Add more property tests. Most test failures are because our Blink
implementation for these properties are lagging behind spec. The only
weird one is line-height, which seems to return 'normal' for negative
values even though the spec doesn't say that anywhere.

Bug: 774887
Change-Id: I9d4a6918b5e9b5772230999b18c6eec4934bcf19
Reviewed-on: https://chromium-review.googlesource.com/936821Reviewed-by: default avatarnainar <nainar@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539222}
parent a1d023d3
<!doctype html>
<meta charset="utf-8">
<title>'box-sizing' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('box-sizing', [
{ syntax: 'content-box'},
{ syntax: 'border-box' }
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'clear' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('clear', [
{ syntax: 'none' },
{ syntax: 'left' },
{ syntax: 'right' },
{ syntax: 'both' },
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'float' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('float', [
{ syntax: 'left' },
{ syntax: 'right' },
{ syntax: 'none' },
]);
</script>
This is a testharness.js-based test.
PASS Can set 'font-style' to CSS-wide keywords
PASS Can set 'font-style' to the 'normal' keyword
PASS Can set 'font-style' to the 'italic' keyword
FAIL Can set 'font-style' to the 'oblique' keyword assert_equals: expected "oblique" but got "italic"
PASS Setting 'font-style' to a length throws TypeError
PASS Setting 'font-style' to a percent throws TypeError
PASS Setting 'font-style' to a time throws TypeError
PASS Setting 'font-style' to a number throws TypeError
PASS Setting 'font-style' to a position throws TypeError
PASS Setting 'font-style' to a transform throws TypeError
Harness: the test ran to completion.
<!doctype html>
<meta charset="utf-8">
<title>'font-style' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('font-style', [
{ syntax: 'normal' },
{ syntax: 'italic' },
{ syntax: 'oblique' },
]);
</script>
This is a testharness.js-based test.
PASS Can set 'line-height' to CSS-wide keywords
PASS Can set 'line-height' to the 'normal' keyword
FAIL Can set 'line-height' to a length assert_equals: relative lengths must compute to a CSSUnitValue expected "[object CSSUnitValue]" but got "[object CSSKeywordValue]"
FAIL Can set 'line-height' to a number assert_equals: relative lengths must compute to a CSSUnitValue expected "[object CSSUnitValue]" but got "[object CSSKeywordValue]"
FAIL Can set 'line-height' to a percent assert_equals: relative lengths must compute to a CSSUnitValue expected "[object CSSUnitValue]" but got "[object CSSKeywordValue]"
PASS Setting 'line-height' to a time throws TypeError
PASS Setting 'line-height' to a position throws TypeError
PASS Setting 'line-height' to a transform throws TypeError
Harness: the test ran to completion.
<!doctype html>
<meta charset="utf-8">
<title>'line-height' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('line-height', [
{ syntax: 'normal' },
{
syntax: '<length>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: '<number>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unit('px', result)
},
{
syntax: '<percentage>',
specified: assert_is_equal_with_range_handling,
computed: (_, result) => assert_is_unit('px', result)
},
]);
</script>
<!doctype html>
<meta charset="utf-8">
<title>'list-style-position' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('list-style-position', [
{ syntax: 'inside' },
{ syntax: 'outside' },
]);
</script>
This is a testharness.js-based test.
PASS Can set 'outline-style' to CSS-wide keywords
FAIL Can set 'outline-style' to the 'auto' keyword Failed to execute 'set' on 'StylePropertyMap': Invalid type for property
PASS Can set 'outline-style' to the 'none' keyword
PASS Can set 'outline-style' to the 'dotted' keyword
PASS Can set 'outline-style' to the 'dashed' keyword
PASS Can set 'outline-style' to the 'solid' keyword
PASS Can set 'outline-style' to the 'double' keyword
PASS Can set 'outline-style' to the 'groove' keyword
PASS Can set 'outline-style' to the 'ridge' keyword
PASS Can set 'outline-style' to the 'inset' keyword
PASS Can set 'outline-style' to the 'outset' keyword
PASS Setting 'outline-style' to a length throws TypeError
PASS Setting 'outline-style' to a percent throws TypeError
PASS Setting 'outline-style' to a time throws TypeError
PASS Setting 'outline-style' to a number throws TypeError
PASS Setting 'outline-style' to a position throws TypeError
PASS Setting 'outline-style' to a transform throws TypeError
Harness: the test ran to completion.
<!doctype html>
<meta charset="utf-8">
<title>'outline-style' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('outline-style', [
{ syntax: 'auto' },
{ syntax: 'none' },
{ syntax: 'dotted' },
{ syntax: 'dashed' },
{ syntax: 'solid' },
{ syntax: 'double' },
{ syntax: 'groove' },
{ syntax: 'ridge' },
{ syntax: 'inset' },
{ syntax: 'outset' },
]);
</script>
This is a testharness.js-based test.
PASS Can set 'overflow-x' to CSS-wide keywords
PASS Can set 'overflow-x' to the 'visible' keyword
PASS Can set 'overflow-x' to the 'hidden' keyword
FAIL Can set 'overflow-x' to the 'clip' keyword Failed to execute 'set' on 'StylePropertyMap': Invalid type for property
PASS Can set 'overflow-x' to the 'scroll' keyword
PASS Can set 'overflow-x' to the 'auto' keyword
PASS Setting 'overflow-x' to a length throws TypeError
PASS Setting 'overflow-x' to a percent throws TypeError
PASS Setting 'overflow-x' to a time throws TypeError
PASS Setting 'overflow-x' to a number throws TypeError
PASS Setting 'overflow-x' to a position throws TypeError
PASS Setting 'overflow-x' to a transform throws TypeError
PASS Can set 'overflow-y' to CSS-wide keywords
PASS Can set 'overflow-y' to the 'visible' keyword
PASS Can set 'overflow-y' to the 'hidden' keyword
FAIL Can set 'overflow-y' to the 'clip' keyword Failed to execute 'set' on 'StylePropertyMap': Invalid type for property
PASS Can set 'overflow-y' to the 'scroll' keyword
PASS Can set 'overflow-y' to the 'auto' keyword
PASS Setting 'overflow-y' to a length throws TypeError
PASS Setting 'overflow-y' to a percent throws TypeError
PASS Setting 'overflow-y' to a time throws TypeError
PASS Setting 'overflow-y' to a number throws TypeError
PASS Setting 'overflow-y' to a position throws TypeError
PASS Setting 'overflow-y' to a transform throws TypeError
Harness: the test ran to completion.
<!doctype html>
<meta charset="utf-8">
<title>'overflow' properties</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
for (const suffix of ['x', 'y']) {
runPropertyTests(`overflow-${suffix}`, [
{ syntax: 'visible' },
{ syntax: 'hidden' },
{ syntax: 'clip' },
{ syntax: 'scroll' },
{ syntax: 'auto' },
]);
}
</script>
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
runPropertyTests('text-decoration-style', [ runPropertyTests('text-decoration-style', [
{ syntax: 'solid' }, { syntax: 'solid' },
{ syntax: 'double' }, { syntax: 'double' },
// and other keywords { syntax: 'dotted' },
{ syntax: 'dashed' },
{ syntax: 'wavy' },
]); ]);
</script> </script>
This is a testharness.js-based test.
PASS Can set 'text-transform' to CSS-wide keywords
PASS Can set 'text-transform' to the 'none' keyword
FAIL Can set 'text-transform' to the 'captialize' keyword Failed to execute 'set' on 'StylePropertyMap': Invalid type for property
PASS Can set 'text-transform' to the 'uppercase' keyword
PASS Can set 'text-transform' to the 'lowercase' keyword
FAIL Can set 'text-transform' to the 'full-width' keyword Failed to execute 'set' on 'StylePropertyMap': Invalid type for property
PASS Setting 'text-transform' to a length throws TypeError
PASS Setting 'text-transform' to a percent throws TypeError
PASS Setting 'text-transform' to a time throws TypeError
PASS Setting 'text-transform' to a number throws TypeError
PASS Setting 'text-transform' to a position throws TypeError
PASS Setting 'text-transform' to a transform throws TypeError
Harness: the test ran to completion.
<!doctype html>
<meta charset="utf-8">
<title>'text-transform' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('text-transform', [
{ syntax: 'none' },
{ syntax: 'captialize' },
{ syntax: 'uppercase' },
{ syntax: 'lowercase' },
{ syntax: 'full-width' },
]);
</script>
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
runPropertyTests('visibility', [ runPropertyTests('visibility', [
{ syntax: 'visible'}, { syntax: 'visible'},
{ syntax: 'hidden' } { syntax: 'hidden' },
// and other keywords { syntax: 'collapse' },
]); ]);
</script> </script>
<!doctype html>
<meta charset="utf-8">
<title>'white-space' property</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-get">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-set">
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#property-stle-value-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<script src="resources/testsuite.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
runPropertyTests('white-space', [
{ syntax: 'normal'},
{ syntax: 'pre' },
{ syntax: 'nowrap' },
{ syntax: 'pre-wrap' },
{ syntax: 'pre-line' },
]);
</script>
...@@ -514,6 +514,7 @@ ...@@ -514,6 +514,7 @@
name_for_methods: "Style", name_for_methods: "Style",
converter: "ConvertFontStyle", converter: "ConvertFontStyle",
priority: "High", priority: "High",
keywords: ["normal", "italic", "oblique"]
}, },
{ {
name: "font-variant-ligatures", name: "font-variant-ligatures",
...@@ -1616,6 +1617,8 @@ ...@@ -1616,6 +1617,8 @@
getter: "SpecifiedLineHeight", getter: "SpecifiedLineHeight",
computed_style_custom_functions: ["getter"], computed_style_custom_functions: ["getter"],
converter: "ConvertLineHeight", converter: "ConvertLineHeight",
keywords: ["normal"],
typedom_types: ["Length", "Number", "Percentage"]
}, },
{ {
name: "line-height-step", name: "line-height-step",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment