Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 19 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/permission-element/install/display-values.tentative.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Install Element: display style validation</title>
<link
rel="help"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function createInstallElementWithStyle(displayValue) {
const element = document.createElement("install");
element.style.display = displayValue;
document.body.appendChild(element);
return element;
}
const testCases = [
["block", ""],
["inline-block", ""],
["flex", ""],
["inline-flex", ""],
["inline", "style_invalid"],
["contents", "style_invalid"],
["inline-table", "style_invalid"],
["list-item", "style_invalid"],
["ruby", "style_invalid"],
["ruby-text", "style_invalid"],
["table", "style_invalid"],
["table-caption", "style_invalid"],
["table-cell", "style_invalid"],
["table-column", "style_invalid"],
["table-column-group", "style_invalid"],
["table-footer-group", "style_invalid"],
["table-header-group", "style_invalid"],
["table-row", "style_invalid"],
["table-row-group", "style_invalid"],
];
testCases.forEach(([displayValue, expectedInvalidReason]) => {
async_test((t) => {
const element = createInstallElementWithStyle(displayValue);
t.add_cleanup(() => element.remove());
element.onvalidationstatuschange = t.step_func(() => {
// These two invalid reasons are expected when the install element was just created.
if (
element.invalidReason == "unsuccessful_registration" ||
element.invalidReason == "intersection_changed"
) {
return;
}
assert_equals(
element.invalidReason,
expectedInvalidReason,
`display: ${displayValue} should be ${expectedInvalidReason === "" ? "valid" : "invalid"}`,
);
t.done();
});
}, `Install element display: ${displayValue} should be ${expectedInvalidReason === "" ? "valid" : "invalid"}`);
});
</script>
</body>
</html>