Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes #4170 * add smoke test for iframe example * add changeset * update changeset wording
- Loading branch information
1 parent
c70e30f
commit 737aaa9
Showing
3 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'slate-react': patch | ||
--- | ||
|
||
Fixes error that occurs when Editor is rendered inside iframe |
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,31 @@ | ||
// Taken from https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/ | ||
const getIframeDocument = () => { | ||
return cy | ||
.get('iframe') | ||
.its('0.contentDocument') | ||
.should('exist') | ||
} | ||
|
||
const getIframeBody = () => { | ||
return ( | ||
getIframeDocument() | ||
.its('body') | ||
// automatically retries until body is loaded | ||
.should('not.be.undefined') | ||
.then(cy.wrap) | ||
) | ||
} | ||
|
||
describe('iframe editor', () => { | ||
beforeEach(() => { | ||
cy.visit('examples/iframe') | ||
}) | ||
|
||
it('should be editable', () => { | ||
getIframeBody() | ||
.findByRole('textbox') | ||
.type('{movetostart}') | ||
.type('Hello World') | ||
.should('contain.text', 'Hello World') | ||
}) | ||
}) |
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