File tree Expand file tree Collapse file tree 5 files changed +13
-4
lines changed
richtext-lexical/src/features/blocks/client
test/fields/collections/Lexical/e2e/blocks Expand file tree Collapse file tree 5 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -541,6 +541,7 @@ export const BlockComponent: React.FC<Props> = (props) => {
541
541
return await onChange ( { formState, submit : true } )
542
542
} ,
543
543
] }
544
+ el = "div"
544
545
fields = { clientBlockFields }
545
546
initialState = { initialState }
546
547
onChange = { [ onChange ] }
Original file line number Diff line number Diff line change @@ -391,6 +391,7 @@ export const InlineBlockComponent: React.FC<Props> = (props) => {
391
391
} ,
392
392
] }
393
393
disableValidationOnSubmit
394
+ el = "div"
394
395
fields = { clientBlock ?. fields }
395
396
initialState = { initialState || { } }
396
397
onChange = { [ onChange ] }
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ export const Form: React.FC<FormProps> = (props) => {
66
66
disableSuccessStatus,
67
67
disableValidationOnSubmit,
68
68
// fields: fieldsFromProps = collection?.fields || global?.fields,
69
+ el,
69
70
handleResponse,
70
71
initialState, // fully formed initial field state
71
72
isDocumentForm,
@@ -783,8 +784,10 @@ export const Form: React.FC<FormProps> = (props) => {
783
784
}
784
785
: { }
785
786
787
+ const El : 'form' = ( el as unknown as 'form' ) || 'form'
788
+
786
789
return (
787
- < form
790
+ < El
788
791
action = { typeof action === 'function' ? void action : action }
789
792
className = { classes }
790
793
method = { method }
@@ -816,7 +819,7 @@ export const Form: React.FC<FormProps> = (props) => {
816
819
</ FormWatchContext . Provider >
817
820
</ FormContext . Provider >
818
821
</ DocumentFormContextComponent >
819
- </ form >
822
+ </ El >
820
823
)
821
824
}
822
825
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export type FormProps = {
25
25
* you can disable checks that the form makes before it submits
26
26
*/
27
27
disableValidationOnSubmit ?: boolean
28
+ /**
29
+ * If you don't want the form to be a <form> element, you can pass a string here to use as the wrapper element.
30
+ */
31
+ el ?: string
28
32
/**
29
33
* By default, the form will get the field schema (not data) from the current document. If you pass this in, you can override that behavior.
30
34
* This is very useful for sub-forms, where the form's field schema is not necessarily the field schema of the current document (e.g. for the Blocks
Original file line number Diff line number Diff line change @@ -1190,7 +1190,7 @@ describe('lexicalBlocks', () => {
1190
1190
// Ensure radio button option1 of radioButtonBlock2 (the default option) is still selected
1191
1191
await expect (
1192
1192
radioButtonBlock2 . locator ( '.radio-input:has-text("Option 1")' ) . first ( ) ,
1193
- ) . toBeChecked ( )
1193
+ ) . toHaveClass ( / r a d i o - i n p u t - - i s - s e l e c t e d / )
1194
1194
1195
1195
// Click radio button option3 of radioButtonBlock2
1196
1196
await radioButtonBlock2
@@ -1201,7 +1201,7 @@ describe('lexicalBlocks', () => {
1201
1201
// Ensure previously clicked option2 of radioButtonBlock1 is still selected
1202
1202
await expect (
1203
1203
radioButtonBlock1 . locator ( '.radio-input:has-text("Option 2")' ) . first ( ) ,
1204
- ) . toBeChecked ( )
1204
+ ) . toHaveClass ( / r a d i o - i n p u t - - i s - s e l e c t e d / )
1205
1205
1206
1206
/**
1207
1207
* Now save and check the actual data. radio button block 1 should have option2 selected and radio button block 2 should have option3 selected
You can’t perform that action at this time.
0 commit comments