Index: LayoutTests/fast/css/script-tests/parsing-object-fit.js |
diff --git a/LayoutTests/fast/css/script-tests/parsing-object-fit.js b/LayoutTests/fast/css/script-tests/parsing-object-fit.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a237f008bacf4070518f349faa18b2043482d474 |
--- /dev/null |
+++ b/LayoutTests/fast/css/script-tests/parsing-object-fit.js |
@@ -0,0 +1,39 @@ |
+description("This tests checks that all of the input values for -webkit-object-fit parse correctly."); |
+ |
+function test(value) |
+{ |
+ var div = document.createElement("div"); |
+ div.setAttribute("style", value); |
+ document.body.appendChild(div); |
+ |
+ var result = div.style.getPropertyValue("object-fit"); |
+ document.body.removeChild(div); |
+ return result; |
+} |
+ |
+function testComputedStyle(value) |
+{ |
+ var div = document.createElement("div"); |
+ div.setAttribute("style", value); |
+ document.body.appendChild(div); |
+ |
+ var result = window.getComputedStyle(div).objectFit; |
+ document.body.removeChild(div); |
+ return result; |
+} |
+ |
+shouldBe('testComputedStyle(";")', '"fill"'); |
+shouldBe('test("object-fit: inherit;")', '"inherit"'); |
+shouldBe('test("object-fit: initial;")', '"initial"'); |
+shouldBe('test("object-fit: fill;")', '"fill"'); |
+shouldBe('test("object-fit: contain;")', '"contain"'); |
+shouldBe('test("object-fit: cover;")', '"cover"'); |
+shouldBe('test("object-fit: none;")', '"none"'); |
+shouldBe('test("object-fit: scale-down;")', '"scale-down"'); |
+ |
+shouldBeNull('test("object-fit: fill contain;")'); |
+shouldBeNull('test("object-fit: bananas;")'); |
+shouldBeNull('test("object-fit: 23px;")'); |
+shouldBeNull('test("object-fit: 20%;")'); |
+ |
+var successfullyParsed = true; |