Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: LayoutTests/fast/css/script-tests/parsing-object-fit.js

Issue 22482004: Add support for the object-fit CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Oops, sorry! Forgot to update UseCounter.cpp Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698