Skip to content

Commit 8b00e50

Browse files
committed
tests: add case for classes merging in blockContentSchema
1 parent bf62d34 commit 8b00e50

File tree

1 file changed

+36
-0
lines changed
  • packages/blocks/src/api/raw-handling/test

1 file changed

+36
-0
lines changed

packages/blocks/src/api/raw-handling/test/utils.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,40 @@ describe( 'getBlockContentSchema', () => {
191191
output
192192
);
193193
} );
194+
195+
it( 'should handle properly merging of classes and attributes', () => {
196+
const transforms = deepFreeze( [
197+
{
198+
blockName: 'my/preformatted',
199+
type: 'raw',
200+
schema: {
201+
pre: {
202+
attributes: [ 'data-chicken' ],
203+
children: myContentSchema,
204+
},
205+
},
206+
},
207+
{
208+
blockName: 'core/preformatted',
209+
type: 'raw',
210+
schema: {
211+
pre: {
212+
attributes: [ 'data-ribs', 'class' ],
213+
children: myContentSchema,
214+
classes: [ 'my-class', 'another-class' ],
215+
},
216+
},
217+
},
218+
] );
219+
const output = {
220+
pre: {
221+
children: myContentSchema,
222+
attributes: [ 'data-chicken', 'data-ribs', 'class' ],
223+
classes: [ 'my-class', 'another-class' ],
224+
},
225+
};
226+
expect( getBlockContentSchemaFromTransforms( transforms ) ).toEqual(
227+
output
228+
);
229+
} );
194230
} );

0 commit comments

Comments
 (0)