npm install
npm run styleguide
- Copy a component from the lux repository into src/components
- This repo uses CSS variables, rather than SCSS token variables. If the component
includes tokens:
- Add
@import "../assets/styles/variables.css";to the<style>section. - Replace any token references to use the CSS variable instead. For example,
$font-family-textcan be changed tovar(--font-family-text).
- Add
- If the component includes SCSS mixins, add
@import "../assets/styles/mixins.scss";to the<style>section. You may also need../assets/styles/spacing.scssif the component uses spacing mixins. - Vue 3 no longer supports functional templates. If the component includes
<template functional>, you will need to refactor it back into a regular template. - Copy the test for the component from the lux test/unit/specs/components directory.
-
Revert any changes to the test that were needed for functional templates.
-
Modify the import for the test to point to the component's new path.
-
Remove any references to
localVue, the new versions of vue-test-utils don't support it or need it. -
Change mount params in this format:
{context: { props: { my_data: "data" }}}to this format:
{props: { my_data: "data" }} -
Run the tests with
npm run test. Make any necessary changes to get the tests to pass.- If a value is not updating correctly after a
wrapper.setPropscall, follow these steps to add anextTick(), which will cause Vue to update the value:- If it's not already imported, add
import { nextTick } from "vue" - Add
asyncto the test arrow function. - Add
await nextTick()between thesetPropsand the assertion.
- If it's not already imported, add
- Refer to the vue-test-utils migration guide for other breaking changes.
- If a value is not updating correctly after a
-
Running the tests will produce a snapshot file. Compare it to the original snapshot file. If there are no substantial changes, commit it. If there are substantial changes, make any necessary changes.
-
We are using the eslint_plugin-prettier to lint our files. To adjust the lint format settings, please use the .prettierrc file. Code linting rules should be set in eslintrc.js.