summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/editing-0/contenteditable/contenteditable-enumerated-ascii-case-insensitive.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/editing/editing-0/contenteditable/contenteditable-enumerated-ascii-case-insensitive.html')
-rw-r--r--testing/web-platform/tests/html/editing/editing-0/contenteditable/contenteditable-enumerated-ascii-case-insensitive.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/editing-0/contenteditable/contenteditable-enumerated-ascii-case-insensitive.html b/testing/web-platform/tests/html/editing/editing-0/contenteditable/contenteditable-enumerated-ascii-case-insensitive.html
new file mode 100644
index 0000000000..0125b95667
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/editing-0/contenteditable/contenteditable-enumerated-ascii-case-insensitive.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href="https://html.spec.whatwg.org/#attr-contenteditable">
+<link rel="help" href="https://html.spec.whatwg.org/#enumerated-attribute">
+<meta name="assert" content="@contenteditable values are ASCII case-insensitive">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+function testValue(value, isValid) {
+ const valueLower = value.toLowerCase();
+
+ test(() => {
+ const el = document.createElement('div');
+ if (valueLower !== "inherit") {
+ el.setAttribute('contenteditable', value);
+ }
+ assert_equals(el.contentEditable, isValid ? valueLower : "inherit");
+ }, `IDL attribute getter for attribute value "${value}"`);
+
+ test(() => {
+ const el = document.createElement('div');
+ if (isValid) {
+ el.contentEditable = value;
+ assert_equals(el.getAttribute('contenteditable'), valueLower === "inherit" ? null : valueLower);
+ } else {
+ assert_throws_dom("SyntaxError", () => {
+ el.contentEditable = value;
+ });
+ }
+ }, `IDL attribute setter for value "${value}"`);
+}
+
+const valid = ["true", "false", "inherit", "plaintext-only"]; // "inherit" is treated specially
+const invalid = ["foobar", "falſe", "plaıntext-only", "plaİntext-only"];
+
+for (const value of valid) {
+ testValue(value, true);
+ testValue(value.toUpperCase(), true);
+}
+
+for (const value of invalid) {
+ testValue(value, false);
+}
+</script>