Index: LayoutTests/fast/css/css-imagevalue-url.html |
diff --git a/LayoutTests/fast/css/css-imagevalue-url.html b/LayoutTests/fast/css/css-imagevalue-url.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3b7fc77f599ace37401680005d1fd8b1168667da |
--- /dev/null |
+++ b/LayoutTests/fast/css/css-imagevalue-url.html |
@@ -0,0 +1,40 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+ |
+<style> |
+div { background-image: url(images.jpg); } |
+</style> |
+ |
+<body> |
+</body> |
+ |
+<script> |
+ var rulesForCssText = function (styleContent) { |
+ var doc = document.implementation.createHTMLDocument(""), |
+ styleElement = document.createElement("style"); |
+ |
+ styleElement.textContent = styleContent; |
+ // the style will only parsed once it is added to a document |
+ doc.body.appendChild(styleElement); |
+ |
+ return styleElement.sheet.cssRules; |
+ }; |
+ |
+ var cssRulesToText = function (cssRules) { |
+ var cssText = ""; |
+ |
+ Array.prototype.slice.call(cssRules).forEach(function (rule) { |
+ cssText += rule.cssText; |
+ }); |
+ return cssText; |
+ }; |
+ |
+ addEventListener("load", function() { |
+ test(function() { |
rune
2015/09/08 23:57:28
Indentation looks inconsistent. Sometimes 8, most
nainar
2015/09/09 00:30:30
Done.
On 2015/09/08 at 23:57:28, rune wrote:
|
+ var styles = document.getElementsByTagName("style"), |
+ cssText = styles[styles.length-1].textContent.trim(); |
+ assert_equals(cssRulesToText(rulesForCssText(cssText)), cssText); |
+ }, 'Testing URLs in CSS'); |
+ }, false); |
+</script> |