OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <p><a href=https://bugs.webkit.org/show_bug.cgi?id=99493>Bug 99493</a></p> | 8 <p><a href=https://bugs.webkit.org/show_bug.cgi?id=99493>Bug 99493</a></p> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 <script> | 10 <script> |
11 description("Test the parsing of the cursor property when used with -webkit-imag
e-set."); | 11 description("Test the parsing of the cursor property when used with -webkit-imag
e-set."); |
12 | 12 |
13 function makeCursorRule(rule) | 13 function makeCursorRule(rule) |
14 { | 14 { |
15 return "cursor: " + rule + ";"; | 15 return "cursor: " + rule + ";"; |
16 } | 16 } |
17 | 17 |
18 function testCursorRule(rule) | 18 function testCursorRule(rule) |
19 { | 19 { |
20 var cssText = makeCursorRule(rule); | 20 var cssText = makeCursorRule(rule); |
21 shouldBeEqualToString('roundtripCssRule("' + cssText + '")', cssText); | 21 shouldBeEqualToString('roundtripCssRule(`' + cssText + '`)', cssText); |
22 } | 22 } |
23 | 23 |
24 function roundtripCssRule(cssText) | 24 function roundtripCssRule(cssText) |
25 { | 25 { |
26 var div = document.createElement("div"); | 26 var div = document.createElement("div"); |
27 div.setAttribute("style", cssText); | 27 div.setAttribute("style", cssText); |
28 document.body.appendChild(div); | 28 document.body.appendChild(div); |
29 var result = div.style.cssText; | 29 var result = div.style.cssText; |
30 document.body.removeChild(div); | 30 document.body.removeChild(div); |
31 return result; | 31 return result; |
32 } | 32 } |
33 | 33 |
34 // Note that any absolute URL will suffice for these tests (can't use relative U
RLs | 34 // Note that any absolute URL will suffice for these tests (can't use relative U
RLs |
35 // since they'll be converted to absolute form in the output). I chose file URL
s just | 35 // since they'll be converted to absolute form in the output). I chose file URL
s just |
36 // to avoid triggering any network activity. | 36 // to avoid triggering any network activity. |
37 | 37 |
38 debug('Test a bunch of cursor rules which should round-trip exactly.'); | 38 debug('Test a bunch of cursor rules which should round-trip exactly.'); |
39 testCursorRule('-webkit-image-set(url(file:///foo.png) 1x), auto'); | 39 testCursorRule('-webkit-image-set(url("file:///foo.png") 1x), auto'); |
40 testCursorRule('-webkit-image-set(url(file:///foo.png) 1x, url(file:///foo2x.png
) 2x), auto'); | 40 testCursorRule('-webkit-image-set(url("file:///foo.png") 1x, url("file:///foo2x.
png") 2x), auto'); |
41 testCursorRule('-webkit-image-set(url(file:///foo.png) 1x, url(file:///foo2x.png
) 2x) 2 3, auto'); | 41 testCursorRule('-webkit-image-set(url("file:///foo.png") 1x, url("file:///foo2x.
png") 2x) 2 3, auto'); |
42 testCursorRule('-webkit-image-set(url(file:///foo03.png) 0.3x, url(file:///foo5x
.png) 5x) 6 5, url(file:///foo.png) 12 3, pointer'); | 42 testCursorRule('-webkit-image-set(url("file:///foo03.png") 0.3x, url("file:///fo
o5x.png") 5x) 6 5, url("file:///foo.png") 12 3, pointer'); |
43 | 43 |
44 successfullyParsed = true; | 44 successfullyParsed = true; |
45 </script> | 45 </script> |
46 </body> | 46 </body> |
47 </html> | 47 </html> |
OLD | NEW |