summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html')
-rw-r--r--testing/web-platform/tests/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html b/testing/web-platform/tests/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html
new file mode 100644
index 0000000000..ceb39bce5d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSKeywordValue.value</title>
+<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-csskeywordvalue-value">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<div id="log"></div>
+<script>
+'use strict';
+
+const gTestArguments = [
+ { keyword: 'initial', description: 'a CSS wide keyword' },
+ { keyword: 'auto', description: 'a CSS keyword' },
+ { keyword: 'lemon', description: 'an unsupported CSS keyword' },
+ { keyword: '3! + 4@', description: 'a string containing multiple tokens' },
+ { keyword: '☺', description: 'a unicode string' },
+];
+
+for (const args of gTestArguments) {
+ test(() => {
+ const result = new CSSKeywordValue(args.keyword);
+ assert_not_equals(result, null, 'a CSSKeywordValue is created');
+ assert_equals(result.value, args.keyword, 'value reflects new value');
+ }, `CSSKeywordValue.value can be updated to ${args.description}`);
+}
+
+test(() => {
+ let result = new CSSKeywordValue('lemon');
+ assert_throws_js(TypeError, () => result.value = '');
+ assert_equals(result.value, 'lemon', 'value does not change');
+}, 'Updating CSSKeywordValue.value with an empty string throws a TypeError');
+
+</script>