47 lines
2.0 KiB
HTML
47 lines
2.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<p id="description"></p>
|
|
<div id="console"></div>
|
|
<script>
|
|
description("Test the parsing of the -webkit-image-set function.");
|
|
|
|
// These have to be global for the test helpers to see them.
|
|
var cssRule;
|
|
|
|
function testInvalidImageSet(description, property, rule, attribute = "image-set")
|
|
{
|
|
debug("");
|
|
debug(description + " : " + rule);
|
|
|
|
var div = document.createElement("div");
|
|
div.setAttribute("style", property + ": " + attribute + "(" + rule + ")");
|
|
document.body.appendChild(div);
|
|
|
|
cssRule = div.style.getPropertyCSSValue(property);
|
|
shouldBe("cssRule", "null");
|
|
|
|
document.body.removeChild(div);
|
|
}
|
|
|
|
testInvalidImageSet("Too many url parameters", "background-image", "url(#a #b)");
|
|
testInvalidImageSet("No x", "background-image", "url('#a') 1");
|
|
testInvalidImageSet("No raw string URLs with prefixed image-set", "background-image", "'image.png' 1x", "-webkit-image-set");
|
|
testInvalidImageSet("Combination of valid and invalid with prefixed image-set", "background-image", "'image.png' 1x, url(image.png) 2x", "-webkit-image-set");
|
|
testInvalidImageSet("Combination of valid and invalid with unprefixed image-set", "background-image", "'' 1x, url(image.png) 2x");
|
|
testInvalidImageSet("No gradients with prefixed image-set", "background-image", "linear-gradient(black, white) 1x", "-webkit-image-set");
|
|
testInvalidImageSet("No comma", "background-image", "url('#a') 1x url('#b') 2x");
|
|
testInvalidImageSet("Too many scale factor parameters", "background-image", "url('#a') 1x 2x");
|
|
testInvalidImageSet("Scale factor is 0", "background-image", "url('#a') 0x");
|
|
testInvalidImageSet("Generated image for cursor", "cursor", "linear-gradient(black, white) 1x");
|
|
testInvalidImageSet("Image-set inside image-set", "background-image", "image-set(image-set(url('#a') 1x) 1x)");
|
|
|
|
successfullyParsed = true;
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|