-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1834 from Codeinwp/fix/form-saving-fse
Allow saving in FSE for Form Options
- Loading branch information
Showing
3 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -537,3 +537,5 @@ export function useTabSwitch( key, defaultValue ) { | |
|
||
return [ tab, setTab ]; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,4 +295,49 @@ test.describe( 'Form Block', () => { | |
|
||
await expect( page.getByLabel( 'Dismiss this notice' ) ).toBeVisible(); | ||
}); | ||
|
||
test( 'enable post save button on options changed', async({ page, editor }) => { | ||
const ccValue = '[email protected]'; | ||
|
||
/* | ||
* Create a form block and insert the CC value using the Inspector Controls. | ||
*/ | ||
|
||
await editor.insertBlock({ name: 'themeisle-blocks/form' }); | ||
|
||
let formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name ); | ||
|
||
expect( formBlock ).toBeTruthy(); | ||
|
||
const { clientId } = formBlock; | ||
|
||
await page.click( `#block-${clientId} > div > fieldset > ul > li:nth-child(1) > button` ); | ||
|
||
// Open the options panel | ||
await page.getByRole( 'button', { name: 'Form Options options' }).click(); | ||
|
||
// activate the option | ||
await page.getByRole( 'menuitemcheckbox', { name: 'Show CC' }).click(); | ||
|
||
// Close the options panel | ||
await page.getByRole( 'button', { name: 'Form Options options' }).click(); | ||
|
||
const cc = page.getByPlaceholder( 'Send copies to' ); | ||
|
||
await cc.fill( ccValue ); | ||
|
||
await editor.publishPost(); | ||
|
||
await page.getByLabel( 'Close panel' ).click(); | ||
|
||
await page.getByPlaceholder( 'Default is to admin site' ).fill( ccValue ); | ||
|
||
const saveBtn = page.getByRole( 'button', { name: 'Update', disabled: false }); | ||
|
||
await saveBtn.waitFor({ | ||
timeout: 4000 | ||
}); | ||
|
||
expect( await saveBtn.isEnabled() ).toBeTruthy(); | ||
}); | ||
}); |