@@ -1277,7 +1277,7 @@ describe('props', () => {
12771277 } )
12781278 } )
12791279
1280- test ( 'binds a camelCase meta prop to its kebab -cased stored attr instead of duplicating it (issue #529)' , ( ) => {
1280+ test ( 'binds a camelCase meta prop to its differently -cased stored attr instead of duplicating it (issue #529)' , ( ) => {
12811281 const props : PropertyMeta [ ] = [
12821282 {
12831283 name : 'fooBar' ,
@@ -1299,35 +1299,8 @@ describe('props', () => {
12991299 schema : 'string | undefined' ,
13001300 declarations : [ ] ,
13011301 } ,
1302- ]
1303-
1304- // Stored attrs are kebab-cased, as produced by the MDC parser
1305- const node = {
1306- type : {
1307- name : 'element' ,
1308- } ,
1309- attrs : {
1310- tag : 'Unicorn' ,
1311- props : {
1312- 'foo-bar' : 'foo bar value' ,
1313- 'baz-qux' : 'baz qux value' ,
1314- } ,
1315- } ,
1316- } as unknown as ProseMirrorNode
1317-
1318- const formTree = buildFormTreeFromProps ( node , createComponentMeta ( props ) )
1319-
1320- // One field per declared prop, bound to the stored value — no empty meta field
1321- // plus a duplicate "custom" field for the kebab-cased key.
1322- expect ( Object . keys ( formTree ) ) . toEqual ( [ 'fooBar' , 'bazQux' ] )
1323- expect ( formTree . fooBar ) . toMatchObject ( { key : 'fooBar' , value : 'foo bar value' , custom : false } )
1324- expect ( formTree . bazQux ) . toMatchObject ( { key : 'bazQux' , value : 'baz qux value' , custom : false } )
1325- } )
1326-
1327- test ( 'still matches an exact camelCase stored attr (regression)' , ( ) => {
1328- const props : PropertyMeta [ ] = [
13291302 {
1330- name : 'fooBar ' ,
1303+ name : 'quuxCorge ' ,
13311304 global : false ,
13321305 description : '' ,
13331306 tags : [ ] ,
@@ -1345,15 +1318,21 @@ describe('props', () => {
13451318 attrs : {
13461319 tag : 'Unicorn' ,
13471320 props : {
1348- fooBar : 'Already camelCase' ,
1321+ 'foo-bar' : 'foo bar value' , // kebab-case, as produced by the MDC parser
1322+ baz_qux : 'baz qux value' , // snake_case
1323+ QuuxCorge : 'quux corge value' , // PascalCase
13491324 } ,
13501325 } ,
13511326 } as unknown as ProseMirrorNode
13521327
13531328 const formTree = buildFormTreeFromProps ( node , createComponentMeta ( props ) )
13541329
1355- expect ( Object . keys ( formTree ) ) . toEqual ( [ 'fooBar' ] )
1356- expect ( formTree . fooBar ) . toMatchObject ( { value : 'Already camelCase' , custom : false } )
1330+ // One field per declared prop, bound to the stored value — no empty meta field
1331+ // plus a duplicate "custom" field for the differently-cased key.
1332+ expect ( Object . keys ( formTree ) ) . toEqual ( [ 'fooBar' , 'bazQux' , 'quuxCorge' ] )
1333+ expect ( formTree . fooBar ) . toMatchObject ( { key : 'fooBar' , value : 'foo bar value' , custom : false } )
1334+ expect ( formTree . bazQux ) . toMatchObject ( { key : 'bazQux' , value : 'baz qux value' , custom : false } )
1335+ expect ( formTree . quuxCorge ) . toMatchObject ( { key : 'quuxCorge' , value : 'quux corge value' , custom : false } )
13571336 } )
13581337
13591338 // test('generate props for video component', () => {
0 commit comments