OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../js/resources/js-test-pre.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 description("This tests checks that all of the input values for obje
ct-fit parse correctly."); |
| 9 |
| 10 function test(value) |
| 11 { |
| 12 var div = document.createElement("div"); |
| 13 div.setAttribute("style", value); |
| 14 document.body.appendChild(div); |
| 15 |
| 16 var result = div.style.getPropertyValue("object-fit"); |
| 17 document.body.removeChild(div); |
| 18 return result; |
| 19 } |
| 20 |
| 21 function testComputedStyle(value) |
| 22 { |
| 23 var div = document.createElement("div"); |
| 24 div.setAttribute("style", value); |
| 25 document.body.appendChild(div); |
| 26 |
| 27 var result = window.getComputedStyle(div).objectFit; |
| 28 document.body.removeChild(div); |
| 29 return result; |
| 30 } |
| 31 |
| 32 shouldBe('testComputedStyle(";")', '"fill"'); |
| 33 shouldBe('test("object-fit: inherit;")', '"inherit"'); |
| 34 shouldBe('test("object-fit: initial;")', '"initial"'); |
| 35 shouldBe('test("object-fit: fill;")', '"fill"'); |
| 36 shouldBe('test("object-fit: contain;")', '"contain"'); |
| 37 shouldBe('test("object-fit: cover;")', '"cover"'); |
| 38 shouldBe('test("object-fit: none;")', '"none"'); |
| 39 shouldBe('test("object-fit: scale-down;")', '"scale-down"'); |
| 40 |
| 41 shouldBeNull('test("object-fit: fill contain;")'); |
| 42 shouldBeNull('test("object-fit: bananas;")'); |
| 43 shouldBeNull('test("object-fit: 23px;")'); |
| 44 shouldBeNull('test("object-fit: 20%;")'); |
| 45 </script> |
| 46 <script src="../js/resources/js-test-post.js"></script> |
| 47 </body> |
| 48 </html> |
OLD | NEW |