This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…dded-mode-iframe Embed preview
- Loading branch information
Showing
18 changed files
with
800 additions
and
101 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,7 @@ | ||
--- | ||
'xstate-viz-app': minor | ||
--- | ||
|
||
Adds the embed preview frame that lets users to configure how they want the embedded visualizer to look like | ||
|
||
<img width="1214" alt="image" src="https://user-images.githubusercontent.com/8332043/134560683-5c654c59-799f-4f18-a927-bea0fd61ec34.png"> |
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,47 @@ | ||
import { GetSourceFileSsrQuery } from '../../src/graphql/GetSourceFileSSR.generated'; | ||
|
||
const SOURCE_ID = 'source-file-id'; | ||
|
||
const getSSRParam = ( | ||
data: Partial<GetSourceFileSsrQuery['getSourceFile']> & { id: string }, | ||
) => { | ||
return encodeURIComponent(JSON.stringify({ data, id: data.id })); | ||
}; | ||
|
||
describe('Embed Preview', () => { | ||
beforeEach(() => { | ||
cy.interceptGraphQL({ | ||
getSourceFile: { | ||
id: SOURCE_ID, | ||
text: ` | ||
import { createModel } from "xstate/lib/model"; | ||
import { createMachine } from "xstate"; | ||
createMachine({ | ||
id: "simple", | ||
states: { | ||
a: {}, | ||
b: {}, | ||
}, | ||
}); | ||
`, | ||
}, | ||
}); | ||
cy.visit( | ||
`/viz/${SOURCE_ID}?ssr=${getSSRParam({ | ||
id: SOURCE_ID, | ||
})}`, | ||
); | ||
}); | ||
|
||
it('Shows Embed button under share menu', () => { | ||
cy.findByRole('button', { name: /share/i }).click(); | ||
cy.findByRole('menuitem', { name: /embed/i }).should('be.visible'); | ||
}); | ||
|
||
it('Clicking on the Embed button opens the Embed preview', () => { | ||
cy.findByRole('button', { name: /share/i }).click(); | ||
cy.findByRole('menuitem', { name: /embed/i }).click(); | ||
cy.getEmbedPreview().should('be.visible'); | ||
}); | ||
}); |
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
Oops, something went wrong.