Closed
Conversation
262bd2e to
5276d1a
Compare
|
5276d1a to
c39fe2a
Compare
|
c39fe2a to
7a3f113
Compare
|
7a3f113 to
95b757e
Compare
Based on changes in [1]. [1]: 28de5b8
Based on a curated set of changes from #901.
So that it overrides the content of the main component in the loaded project. Based on a curated set of changes from #901.
TODO: Explain what web component `embedded` attribute does Based on a curated set of changes from #901. Note that in the original PR, an unnecessary call to `dispatch(setEmbedded(embedded))` was added in `WebComponentLoader`. This was unnecessary, because there was already a call to the `useEmbeddedMode` hook which does the same thing, so I have removed it from this commit.
Based on [1]. We're about to make a change in this area of the code. Making this change first will make it easier to see what's being changed in the subsequent commit. [1]: 4440a87
|
This adds a new e2e spec which loads the web component with its
attributes set to mimic the usage by Block-to-Text alpha app [1,2].
* The `assets_identifier` attribute is set to load the assets (but not
the code) from the "encoded-art-starter" project which includes a
`moon.png` image.
* The `host_styles` attribute is set partly because it is used by the
Block-to-Text app, but also because otherwise the output-only editor
has zero height in the Electron browser used by default by Cypress.
* The `code` attribute is set to load a simple P5 sketch which draws the
word "PASS" in green and draws the `moon.png` image on the canvas.
* The `output_only` attribute is set to `true` so that only the output
pane of the editor is displayed; not the code editor, the run bar,
etc.
* The `output_panels` attribute is set to `["visual"]` so that only the
visual output canvas is displayed; not the text output.
* A "Run code" button has been added to `src/web-component.html` to
mimic a similar button in the Block-to-Text app which has an `onclick`
handler to call the `rerunCode` method on the web component.
Note that the "embedded-viewer" CSS class that we're asserting against
is added by the `WebComponentProject` component around the `Output`
component; not by the `EmbeddedViewer` component which is currently only
used via the `/:locale/embed/viewer/:identifier` route which is used in
an iframe by e.g. the Projects app.
By asserting the results contain '{"errorDetails":{}}' we can have some
confidence that the P5 sketch code has run successfully.
TODO:
* Do we need to set the `embedded` attribute to `true` like the
Block-to-Text app? It seems unnecessary.
* The drawing of the `moon.png` image doesn't seem to work at all in
Electron or Chrome and only patchily in Firefox (and even then only
when caching is not disabled). Does this highlight an actual problem?
* If `assets_identifier` is not set, the spec doesn't fail in Electron,
although an uncaught exception is thrown when the image is fetched. Is
this a sufficient test? Also does the uncaught exception highlight an
actual problem - shouldn't it be caught?
[1]: https://block-to-text-alpha.pages.dev/
[2]: https://github.com/RaspberryPiFoundation/block-to-text-alpha/
95b757e to
7a0bf73
Compare
|
Contributor
Author
|
Superseded by #1019. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.