File tree Expand file tree Collapse file tree 5 files changed +18
-5
lines changed
ppx/test/css-support/backgrounds-and-borders-module.t Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1212 "jsdom" : " ^21.1.0" ,
1313 "react" : " ^18.2.0" ,
1414 "react-dom" : " ^18.2.0" ,
15-
1615 "webpack" : " ^5.73.0" ,
1716 "webpack-cli" : " ^4.9.2" ,
1817 "webpack-dev-server" : " ^4.9.1"
Original file line number Diff line number Diff line change @@ -89,9 +89,16 @@ let container = [%cx
8989];
9090
9191module App = {
92+ let blockDefaultBackground = [% cx
93+ {|
94+ background-size: 20px 20px;
95+ background-position: 0 0, 10px 0, 10px -10px, 0 10px;
96+ |}
97+ ];
98+
9299 [@ react . component ]
93100 let make = () =>
94- <>
101+ <main className = blockDefaultBackground >
95102 <div className= post>
96103 <div className= {card ++ " " ++ container}>
97104 <h2 > {React . string("Card title" )} </h2 >
@@ -102,7 +109,7 @@ module App = {
102109 <div className= clx> {React . string("code everywhere!" )} </div >
103110 <div className= selectors> {React . string("Red text" )} </div >
104111 </Cositas >
105- </>;
112+ </main >;
106113};
107114
108115let color = ` hex ("333" );
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ module Color = {
4545[% css {| background-size: 10px auto|} ];
4646[% css {| background-size: auto 10%|} ];
4747[% css {| background-size: 50em 50%|} ];
48+ [% css {| background-size: 20px 20px|} ];
4849/* [%css {|background: url(foo.png), url(bar.svg)|}]; */
4950[% css {| background: top left / 50% 60%|} ];
5051[% css {| background: border-box|} ];
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ If this test fail means that the module is not in sync with the ppx
6161 CSS. backgroundSize(`size((`pxFloat(10 . ), `auto)));
6262 CSS. backgroundSize(`size((`auto, `percent(10 . ))));
6363 CSS. backgroundSize(`size((`em(50 . ), `percent(50 . ))));
64+ CSS. backgroundSize(`size((`pxFloat(20 . ), `pxFloat(20 . ))));
6465
6566 CSS. backgroundPosition(`hvOffset((`left, `top)));
6667 CSS. backgroundOrigin(`borderBox);
Original file line number Diff line number Diff line change @@ -3653,9 +3653,14 @@ module BackgroundSize = struct
36533653 let size (x : [ Length.t | Auto.t ] ) (y : [ Length.t | Auto.t ] ) =
36543654 `size (x, y)
36553655
3656- let rec toString (x : t ) =
3656+ let size_to_string (x : [ Length.t | Auto.t ] ) =
3657+ match x with
3658+ | #Length. t as l -> Length. toString l
3659+ | #Auto. t -> Auto. toString
3660+
3661+ let toString (x : t ) =
36573662 match x with
3658- | `size (x , y ) -> (toString (x :> t ) ^ {js| | js}) ^ toString (y :> t )
3663+ | `size (x , y ) -> size_to_string x ^ {js| | js} ^ size_to_string y
36593664 | `cover -> {js| cover| js}
36603665 | `contain -> {js| contain| js}
36613666 | #Length. t -> Auto. toString
You can’t perform that action at this time.
0 commit comments