This repo contains the necessary code to develop and publish an NPM package for creating formatted text editors for use in Squiz products.
The formatted text editor is using the Remirror React library.
Provided you have Volta
installed as soon as you are in the formatted-text-editor
directory you should be on the correct Node version.
See the package.json
for the specific version.
Now run the following commands from the packages/formatted-text-editor/
directory.
npm i
npm run dev
This will expose http://localhost:5173/
and this can be viewed in the browser.
TIP: Make sure you have already installed the node modules at the root level of the repo.
Tests must be written when contributing to this package. Tests are automatically run in CI and test failure will result in unmerged code.
This package using Jest to perform Unit testing. In addition to Jest we are using a few Testing Library utilities:
- React testing library - Enables React component testing
- Jest DOM - Enables custom matchers
Tests should be co-located with componentry and should strive for maximum coverage.
To run tests locally you can run:
npm run test
Or if you'd like to "watch" for changes:
npm run test:watch
When testing text input in the text editor, it is recommended to use the <MockEditor />
component, which is a simple wrapper around the Remirror component that provides additional functionality for testing (supplying text into the editor).
Test coverage is enforced globally in this package. You can run the test coverage script from the package root:
npm run test:coverage
Coverage will also run as part of the normal test script. Please see ./jest.config.ts for the currently configured thresholds.
This package uses Cypress for end to end testing.
To run tests locally you can run:
npm run test:e2e
Cypress is configured to look at a preview dev environment on http://localhost:8080
.