File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -1133,3 +1133,75 @@ test("variable names can be js identifiers", () => {
11331133 )
11341134 ) ;
11351135} ) ;
1136+
1137+ test ( "Renders nothing if only templates are present in block" , ( ) => {
1138+ const Bt = ws [ "block-template" ] ;
1139+
1140+ expect (
1141+ generateWebstudioComponent ( {
1142+ classesMap : new Map ( ) ,
1143+ scope : createScope ( ) ,
1144+ name : "Page" ,
1145+ rootInstanceId : "body" ,
1146+ parameters : [ ] ,
1147+ dataSources : new Map ( ) ,
1148+ indexesWithinAncestors : new Map ( ) ,
1149+ ...renderJsx (
1150+ < $ . Body ws :id = "body" >
1151+ < ws . block ws :id = "block" >
1152+ < Bt >
1153+ < $ . Box > Test</ $ . Box >
1154+ </ Bt >
1155+ </ ws . block >
1156+ </ $ . Body >
1157+ ) ,
1158+ } )
1159+ ) . toEqual (
1160+ validateJSX (
1161+ clear ( `
1162+ const Page = () => {
1163+ return <Body>
1164+ </Body>
1165+ }
1166+ ` )
1167+ )
1168+ ) ;
1169+ } ) ;
1170+
1171+ test ( "Renders only block children" , ( ) => {
1172+ const Bt = ws [ "block-template" ] ;
1173+
1174+ expect (
1175+ generateWebstudioComponent ( {
1176+ classesMap : new Map ( ) ,
1177+ scope : createScope ( ) ,
1178+ name : "Page" ,
1179+ rootInstanceId : "body" ,
1180+ parameters : [ ] ,
1181+ dataSources : new Map ( ) ,
1182+ indexesWithinAncestors : new Map ( ) ,
1183+ ...renderJsx (
1184+ < $ . Body ws :id = "body" >
1185+ < ws . block ws :id = "block" >
1186+ < Bt >
1187+ < $ . Box > Test</ $ . Box >
1188+ </ Bt >
1189+ < $ . Box > Child0</ $ . Box >
1190+ </ ws . block >
1191+ </ $ . Body >
1192+ ) ,
1193+ } )
1194+ ) . toEqual (
1195+ validateJSX (
1196+ clear ( `
1197+ const Page = () => {
1198+ return <Body>
1199+ <Box>
1200+ {"Child0"}
1201+ </Box>
1202+ </Body>
1203+ }
1204+ ` )
1205+ )
1206+ ) ;
1207+ } ) ;
You can’t perform that action at this time.
0 commit comments