Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compat: Test -webkit-appearance and appearance properties
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!doctype html> | ||
<title>-webkit-appearance</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<button id=button>Test</button> | ||
<script> | ||
const button = document.getElementById('button'); | ||
// values from https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance | ||
// intersection of Firefox and Chrome. | ||
const values = ["none", | ||
"button", | ||
"button-bevel", | ||
"caret", | ||
"checkbox", | ||
"listbox", | ||
"listitem", | ||
"menulist", | ||
"menulist-button", | ||
"menulist-text", | ||
"menulist-textfield", | ||
"radio", | ||
"searchfield", | ||
"textfield", | ||
]; | ||
for (const value of values) { | ||
test(() => { | ||
button.removeAttribute('style'); | ||
button.style.setProperty('-webkit-appearance', value); | ||
assert_equals(button.style.WebkitAppearance, value); | ||
assert_equals(button.style.webkitAppearance, value); // lowercase w | ||
const style = getComputedStyle(button); | ||
assert_equals(style.WebkitAppearance, value); | ||
assert_equals(style.webkitAppearance, value); // lowercase w | ||
}, `-webkit-appearance: ${value}`); | ||
} | ||
|
||
const invalidValues = ["bogus-button"]; | ||
for (const invalidValue of invalidValues) { | ||
test(() => { | ||
button.removeAttribute('style'); | ||
button.style.setProperty('-webkit-appearance', invalidValue); | ||
assert_equals(button.style.WebkitAppearance, ""); | ||
assert_equals(button.style.webkitAppearance, ""); // lowercase w | ||
const style = getComputedStyle(button); | ||
assert_equals(style.WebkitAppearance, "button"); | ||
assert_equals(style.webkitAppearance, "button"); // lowercase w | ||
}, `-webkit-appearance: ${invalidValue} (invalid)`); | ||
} | ||
|
||
test(() => { | ||
button.removeAttribute('style'); | ||
button.style.setProperty('appearance', 'auto'); | ||
assert_equals(button.style.appearance, undefined); | ||
const style = getComputedStyle(button); | ||
assert_equals(style.appearance, undefined); | ||
}, 'appearance'); | ||
</script> |