blob: 0b60ec4442b0ffa445429e50b35795494902e6bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<!doctype html>
<meta charset="utf-8">
<title>CSSImageValue normalization tests</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#resourcevalue-normalization">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testhelper.js"></script>
<body>
<script>
'use strict';
const gTestUrl = '/media/1x1-green.png';
const gBadTestUrl = document.location.href;
test(t => {
const result = CSSStyleValue.parse('background-image', 'url("' + gTestUrl + '")');
assert_class_string(result, 'CSSImageValue');
}, 'Normalizing a valid <url> returns a CSSImageValue');
test(t => {
const result = CSSStyleValue.parse('background-image', 'url("' + gBadTestUrl + '")');
assert_class_string(result, 'CSSImageValue');
}, 'Normalizing a bad <url> returns a CSSImageValue');
test(t => {
const result = CSSStyleValue.parse('background-image', 'linear-gradient(red, orange)');
assert_equals(result.constructor.name, 'CSSImageValue');
}, 'Normalizing a <gradient> returns a CSSImageValue');
</script>
|