chromium/third_party/blink/web_tests/fast/css/font-variant-shorthand-from-longhands.html

<!DOCTYPE html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Test the return values for the font variant properties on the style object.")

var testContainer = document.createElement("div");
document.body.appendChild(testContainer);

testContainer.innerHTML = '<div id="testElement">hello</div>';
var style = testElement.style;
var computedStyle = getComputedStyle(testElement);

// We need all font longhands to build the shorthand.
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "normal");

style.fontVariantCaps = "small-caps";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "small-caps");

style.fontVariantLigatures = "discretionary-ligatures";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures small-caps");

style.fontVariantNumeric = "proportional-nums";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures small-caps proportional-nums");

style.fontVariantAlternates = "historical-forms";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures small-caps historical-forms proportional-nums");

style.fontVariantPosition = "super";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures small-caps historical-forms proportional-nums super");

style.fontVariantEmoji = "emoji";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures small-caps historical-forms proportional-nums super emoji");

style.fontVariantEastAsian = "ruby";
// The |style.fontVariant| shorthand is set when all currently supported
// sub-properties are set.
shouldBeEqualToString("style.fontVariant", "discretionary-ligatures small-caps historical-forms proportional-nums ruby super emoji");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures small-caps historical-forms proportional-nums ruby super emoji");

style.fontVariantCaps = "normal";
shouldBeEqualToString("style.fontVariant", "discretionary-ligatures historical-forms proportional-nums ruby super emoji");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures historical-forms proportional-nums ruby super emoji");

style.fontVariantPosition = "normal";
shouldBeEqualToString("style.fontVariant", "discretionary-ligatures historical-forms proportional-nums ruby emoji");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures historical-forms proportional-nums ruby emoji");

style.fontVariantEmoji = "normal";
shouldBeEqualToString("style.fontVariant", "discretionary-ligatures historical-forms proportional-nums ruby");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures historical-forms proportional-nums ruby");

style.fontVariantAlternates = "normal";
shouldBeEqualToString("style.fontVariant", "discretionary-ligatures proportional-nums ruby");
shouldBeEqualToString("computedStyle.fontVariant", "discretionary-ligatures proportional-nums ruby");

style.fontVariantCaps = "small-caps";
style.fontVariantLigatures = "normal";
shouldBeEqualToString("style.fontVariant", "small-caps proportional-nums ruby");
shouldBeEqualToString("computedStyle.fontVariant", "small-caps proportional-nums ruby");

style.fontVariantNumeric = "normal";
shouldBeEqualToString("style.fontVariant", "small-caps ruby");
shouldBeEqualToString("computedStyle.fontVariant", "small-caps ruby");

style.fontVariantLigatures = "none";
shouldBeEqualToString("style.fontVariant", "");
shouldBeEqualToString("computedStyle.fontVariant", "");

style.fontVariantCaps = "initial";
style.fontVariantLigatures = "initial";
style.fontVariantNumeric = "initial";
style.fontVariantEastAsian = "initial";
style.fontVariantAlternates = "initial";
style.fontVariantPosition = "initial";
style.fontVariantEmoji = "initial";
shouldBeEqualToString("style.fontVariant", "initial");

document.body.removeChild(testContainer);
</script>
</body>