-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce cssStylesToInject prop for SilverbackIframe
- Loading branch information
Showing
7 changed files
with
125 additions
and
22 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
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
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { gatsby } from '@amazeelabs/silverback-playwright'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
import { getIframe } from '../../silverback-drupal/common'; | ||
|
||
test('injected CSS styles', async ({ page }) => { | ||
// Check if it isn't green by default. | ||
await page.goto(`${gatsby.baseUrl}/en/form/for-testing-confirmation-options`); | ||
await expect((await getIframe(page)).locator('h1')).not.toHaveCSS( | ||
'color', | ||
'rgb(0, 128, 0)', | ||
); | ||
|
||
// Inject CSS. | ||
await page.goto( | ||
`${gatsby.baseUrl}/en/form/for-testing-confirmation-options?test-inject-css=true`, | ||
); | ||
// Check if it's green. | ||
await expect((await getIframe(page)).locator('h1')).toHaveCSS( | ||
'color', | ||
'rgb(0, 128, 0)', | ||
); | ||
// Check if we have additional margin at the bottom of the field. | ||
await expect( | ||
(await getIframe(page)).locator('.form-item-optional-text-field'), | ||
).toHaveCSS('margin-bottom', '200px'); | ||
// Check if the iframe was resized. We should still see the Submit button. | ||
await expect((await getIframe(page)).locator('text=Submit')).toBeVisible(); | ||
}); |