Skip to content

Commit b956a6e

Browse files
committed
Merge pull request #129 from mattiacci/object-fit-and-position
Add support for object-fit and object-position
2 parents 846f20d + 1993d25 commit b956a6e

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/css/Properties.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ var Properties = {
394394
"nav-up" : 1,
395395

396396
//O
397+
"object-fit" : "fill | contain | cover | none | scale-down",
398+
"object-position" : "<bg-position>",
397399
"opacity" : "<number> | inherit",
398400
"order" : "<integer>",
399401
"-webkit-order" : "<integer>",

tests/css/Validation.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,52 @@
826826
}
827827
}));
828828

829+
suite.add(new ValidationTestCase({
830+
property: "object-fit",
831+
832+
valid: [
833+
"fill",
834+
"contain",
835+
"cover",
836+
"none",
837+
"scale-down"
838+
],
839+
840+
invalid: {
841+
"foo" : "Expected (fill | contain | cover | none | scale-down) but found 'foo'.",
842+
"inherit" : "Expected (fill | contain | cover | none | scale-down) but found 'inherit'."
843+
}
844+
}));
845+
846+
suite.add(new ValidationTestCase({
847+
property: "object-position",
848+
849+
valid: [
850+
"top",
851+
"bottom",
852+
"center",
853+
"100%",
854+
"left center",
855+
"bottom left",
856+
"left 10px",
857+
"center bottom",
858+
"10% top",
859+
"left 10px bottom",
860+
"right top 5%",
861+
"top 3em center",
862+
"center top 3em",
863+
"top 3em right 10%",
864+
],
865+
866+
invalid: {
867+
"foo" : "Expected (<bg-position>) but found 'foo'.",
868+
"10% left" : "Expected end of value but found 'left'.",
869+
"left center right" : "Expected end of value but found 'center'.",
870+
"center 3em right 10%": "Expected end of value but found '3em'.",
871+
"top, bottom" : "Expected end of value but found ','."
872+
}
873+
}));
874+
829875
suite.add(new ValidationTestCase({
830876
property: "opacity",
831877

0 commit comments

Comments
 (0)