OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src='../../resources/testharness.js'></script> |
| 5 <script src='../../resources/testharnessreport.js'></script> |
| 6 </head> |
| 7 <body> |
| 8 <div id='testElement'></div> |
| 9 <style> |
| 10 #testElement { |
| 11 background-image: url("resources/1x1-green.png"); |
| 12 } |
| 13 </style> |
| 14 <script> |
| 15 var locationPath = location.href.substring(0, location.href.lastIndexOf('/')); |
| 16 var imagePath = locationPath + '/resources/1x1-green.png'; |
| 17 |
| 18 var computedStyleMap = getComputedStyleMap(testElement); |
| 19 |
| 20 function checks() { |
| 21 var result = computedStyleMap.get('background-image'); |
| 22 assert_true(result instanceof CSSURLImageValue); |
| 23 assert_equals(result.cssText, 'url(\"' + imagePath + '\")'); |
| 24 assert_equals(result.state, 'loaded'); |
| 25 assert_equals(result.intrinsicWidth, 1); |
| 26 assert_equals(result.intrinsicHeight, 1); |
| 27 assert_equals(result.intrinsicRatio, 1); |
| 28 } |
| 29 |
| 30 var t1 = async_test('Getting a background-image with a relative URL image value
returns a CSSURLImageValue'); |
| 31 function t1Callback() { |
| 32 t1.step(checks); |
| 33 t1.done(); |
| 34 } |
| 35 |
| 36 var t2 = async_test('Getting a background-image with a URL image value returns a
CSSURLImageValue'); |
| 37 function t2Callback() { |
| 38 testElement.style.backgroundImage = 'url(\"' + imagePath + '\")'; |
| 39 t2.step(checks); |
| 40 t2.done(); |
| 41 } |
| 42 |
| 43 document.onreadystatechange = function() { |
| 44 if(document.readyState == 'complete') { |
| 45 t1Callback(); |
| 46 t2Callback(); |
| 47 } |
| 48 }; |
| 49 |
| 50 </script> |
| 51 </body> |
| 52 </html> |
OLD | NEW |