Skip to content

Test your kit ​

A kit is right when the editor offers what the design allows, and the published page looks like the canvas. Check it by hand once, and keep the parts that can break under automatic tests.

After every change ​

  1. Rebuild caches (drush cr) and the theme's CSS (npm run dist in the subtheme, or frame build). The tokens are read from the .info.yml, and an unknown token name in SCSS stops the build with the names the theme has.
  2. Look at Reports → Status report: it says when the default theme is not the Frame theme or a subtheme, and when a component's version was raised without a post update function.

In the editor ​

Open a page of a content type that uses Frame:

  1. Tokens. Select a component, open Layout and style: Spacing, Text, Size and Border list your names and values; Background and Text list your palette with its labels. An image offers only your image_styles.
  2. Breakpoints. The tabs above Layout and style and the Preview list your breakpoints.
  3. Components. Each is in its group of the Blocks panel, with its icon; components you left out are not there.
  4. Drag each one in. It is visible and can be selected when empty: give an empty component a minimum height or a placeholder if it collapses to nothing.
  5. Every field changes the canvas.
  6. Set a spacing, a background colour and a width: they apply to the root element of the component. Switched-off features are not offered.
  7. Drop something into each slot, and next to the component.
  8. Check the editor's own controls: if buttons or inputs of the editor look off, a global rule of the kit reaches them (see A CSS framework).
  9. Publish, open the page, and compare it with the canvas. Then the Preview at each breakpoint.

Automatic tests ​

  • Components in React are tested with Jest, as any subtheme component: npm test in the subtheme (Testing).
  • What a component renders can be checked with Drupal's ComponentKernelTestBase for the Twig and its props.
  • The kit itself. The module's own tests use small fixture themes with known tokens and components, in modules/frame_editor/tests/themes/ (frame_editor_test_theme and others): read them for a minimal kit, and copy the pattern for a test of your own that renders a layout with your components.
  • A component's schema. When a component changes, Frame remembers its last schema and warns on the status report if a version was raised without a post update. See Versions and migrations.

Limitations ​

  • There is no visual comparison of canvas and page built in: compare them by eye, or with your own screenshot tests.
  • The canvas follows the window for your own media queries; only the Preview shows the page at a breakpoint's width with them.