Skip to content

PR 782 curated#1014

Closed
floehopper wants to merge 9 commits intomainfrom
pr-782-curated
Closed

PR 782 curated#1014
floehopper wants to merge 9 commits intomainfrom
pr-782-curated

Conversation

@floehopper
Copy link
Contributor

No description provided.

@floehopper floehopper temporarily deployed to previews/pr-782-curated May 20, 2024 12:56 — with GitHub Actions Inactive
@github-actions
Copy link

@floehopper floehopper temporarily deployed to previews/pr-782-curated May 20, 2024 15:16 — with GitHub Actions Inactive
@github-actions
Copy link

@floehopper floehopper temporarily deployed to previews/pr-782-curated May 20, 2024 15:18 — with GitHub Actions Inactive
@github-actions
Copy link

@floehopper floehopper temporarily deployed to previews/pr-782-curated May 22, 2024 13:17 — with GitHub Actions Inactive
Scott and others added 7 commits May 22, 2024 14:18
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
@github-actions
Copy link

loiswells97 and others added 2 commits May 22, 2024 14:19
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/
@github-actions
Copy link

@floehopper floehopper temporarily deployed to previews/add-support-for-block-to-text-app May 22, 2024 16:27 — with GitHub Actions Inactive
@floehopper
Copy link
Contributor Author

Superseded by #1019.

@floehopper floehopper closed this May 22, 2024
@floehopper floehopper deleted the pr-782-curated branch June 3, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants