blob: 420f03076858e45a31e774ba7bd951013c71c327 [file] [log] [blame]
<!DOCTYPE html>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<script>
test(function() {
assert_throws(TypeError(), function() { new CSSKeywordValue("") });
}, "Constructor should throw an error if given an empty string");
test(function() {
assert_equals(new CSSKeywordValue('initial').cssText, 'initial');
assert_equals(new CSSKeywordValue('center').cssText, 'center');
assert_equals(new CSSKeywordValue('customLemon').cssText, 'customLemon');
assert_equals(new CSSKeywordValue(' Hello World').cssText, CSS.escape(' Hello World'));
assert_equals(new CSSKeywordValue('3').cssText, CSS.escape('3'));
}, 'cssText returns a string with a format similar to CSS.escape. This test also ' +
'implies that toCSSValue supports all keywords including custom identifiers');
test(function() {
assert_equals(new CSSKeywordValue('initial').keywordValue, 'initial');
assert_equals(new CSSKeywordValue('center').keywordValue, 'center');
assert_equals(new CSSKeywordValue('customLemon').keywordValue, 'customLemon');
assert_equals(new CSSKeywordValue(' Hello World').keywordValue, ' Hello World');
assert_equals(new CSSKeywordValue('3').keywordValue, '3');
}, 'keywordValue returns a string equal to the string used in the constructor');
</script>
<body>
</body>