ladybird/Tests/LibWeb/Text/input/css/FontFace.html
Andrew Kaster 2bc51f08d9 LibWeb: Implement or stub FontFace interface's attribute getters/setters
We only support parsing half of these, so the ones we don't recognize
get a friendly exception thrown.
2024-05-11 07:30:29 +01:00

58 lines
1.8 KiB
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
let face = new FontFace("Some font family", "url(some_font_family.ttf)");
println(`face.family: ${face.family}`);
println(`face.style: ${face.style}`);
println(`face.weight: ${face.weight}`);
println(`face.stretch: ${face.stretch}`);
// FIXME: Implement setters for the following props:
println(`face.unicodeRange: ${face.unicodeRange}`);
println(`face.featureSettings: ${face.featureSettings}`);
println(`face.variationSettings: ${face.variationSettings}`);
println(`face.display: ${face.display}`);
println(`face.ascentOverride: ${face.ascentOverride}`);
println(`face.descentOverride: ${face.descentOverride}`);
println(`face.lineGapOverride: ${face.lineGapOverride}`);
// Set valid values
face.family = "Another font family";
face.style = "italic";
face.weight = "bold";
face.stretch = "condensed";
println(`face.family: ${face.family}`);
println(`face.style: ${face.style}`);
println(`face.weight: ${face.weight}`);
println(`face.stretch: ${face.stretch}`);
// Set invalid values and expect exception
try {
face.family = 1;
} catch (e) {
println(`face.family = 1: ${e}`);
}
try {
face.style = 1;
} catch (e) {
println(`face.style = 1: ${e}`);
}
try {
face.weight = "500kg";
} catch (e) {
println(`face.weight = 500kg: ${e}`);
}
try {
face.stretch = "super stretched";
} catch (e) {
println(`face.stretch = super stretched: ${e}`);
}
});
</script>