@@ -146,25 +146,71 @@ describe('Element', () => {
146146 )
147147 } )
148148
149+ it ( 'should divide wrapper and icon asset when children is a square' , async ( ) => {
150+ const element = createElement ( 'FRAME' , {
151+ width : '100px' ,
152+ height : '120px' ,
153+ children : [ createNode ( 'VECTOR' , { width : '60px' , height : '60px' } ) ] ,
154+ } )
155+ expect ( await element . getComponentType ( ) ) . toEqual ( 'Box' )
156+ expect ( await element . render ( ) ) . toEqual (
157+ '<Box w="100px" h="120px">\n <Image boxSize="60px" />\n</Box>' ,
158+ )
159+ } )
160+
149161 describe ( 'Overlap' , async ( ) => {
150162 it ( 'should render Image with overlap' , async ( ) => {
151- const element = createElement ( 'INSTANCE' , {
152- name : 'image' ,
153- width : '60px' ,
154- height : '60px' ,
155- children : [
156- createNode ( 'VECTOR' , {
157- fills : [ ] ,
158- } ) ,
159- createNode ( 'STAR' , {
160- fills : [ ] ,
161- } ) ,
162- ] ,
163- } )
164- expect ( await element . getComponentType ( ) ) . toEqual ( 'Image' )
165- expect ( await element . render ( ) ) . toEqual (
166- '<Image boxSize="60px" src="image" />' ,
167- )
163+ {
164+ const element = createElement ( 'INSTANCE' , {
165+ name : 'image' ,
166+ width : '60px' ,
167+ height : '60px' ,
168+ children : [
169+ createNode ( 'VECTOR' , {
170+ fills : [ ] ,
171+ } ) ,
172+ createNode ( 'STAR' , {
173+ fills : [ ] ,
174+ } ) ,
175+ ] ,
176+ } )
177+ expect ( await element . getComponentType ( ) ) . toEqual ( 'Image' )
178+ expect ( await element . render ( ) ) . toEqual (
179+ '<Image boxSize="60px" src="image" />' ,
180+ )
181+ }
182+ {
183+ const element = createElement ( 'FRAME' , {
184+ width : '100px' ,
185+ height : '120px' ,
186+ children : [
187+ createNode ( 'RECTANGLE' , {
188+ width : '100px' ,
189+ fills : [ ] ,
190+ height : '120px' ,
191+ children : [
192+ createNode ( 'FRAME' , {
193+ name : 'image' ,
194+ width : '60px' ,
195+ height : '60px' ,
196+ children : [
197+ createNode ( 'VECTOR' , {
198+ fills : [ ] ,
199+ } ) ,
200+ createNode ( 'STAR' , {
201+ fills : [ ] ,
202+ } ) ,
203+ ] ,
204+ } ) ,
205+ ] ,
206+ } ) ,
207+ ] ,
208+ } )
209+ expect ( await element . getComponentType ( ) ) . toEqual ( 'Box' )
210+ expect ( await element . render ( ) ) . toEqual (
211+ '<Box w="100px" h="120px">\n <Box w="100%" h="120px">\n <Image boxSize="60px" src="image" />\n </Box>\n</Box>' ,
212+ )
213+ }
168214 } )
169215
170216 it ( 'should render Image with overlap' , async ( ) => {
@@ -450,7 +496,7 @@ describe('Element', () => {
450496 const element = createElement ( 'RECTANGLE' , {
451497 name : 'image' ,
452498 width : '60px' ,
453- height : '60px ' ,
499+ height : '68px ' ,
454500 fills : [
455501 {
456502 type : 'IMAGE' ,
@@ -459,7 +505,7 @@ describe('Element', () => {
459505 } )
460506 expect ( await element . getComponentType ( ) ) . toEqual ( 'Image' )
461507 expect ( await element . render ( ) ) . toEqual (
462- '<Image boxSize ="60px" src="image" />' ,
508+ '<Image w ="60px" h="68px " src="image" />' ,
463509 )
464510 }
465511 {
0 commit comments