Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(radio): Change tests to react-testing-library and improve coverage #381

Merged
merged 36 commits into from
Feb 6, 2020
Merged

test(radio): Change tests to react-testing-library and improve coverage #381

merged 36 commits into from
Feb 6, 2020

Conversation

mannycarrera4
Copy link
Contributor

@mannycarrera4 mannycarrera4 commented Dec 18, 2019

Fixes adding test for radio: #286

Checklist

  • branch has been rebased on the latest master commit
  • tests are changed or added
  • yarn test passes
  • all (dev)dependencies that the module needs is added to its package.json
  • code has been documented and, if applicable, usage described in README.md
  • module has been added to canvas-kit-react and/or canvas-kit-css universal modules, if
    applicable
  • design approved final implementation
  • a11y approved final implementation
  • code adheres to the API & Pattern guidelines

Additional References

package.json Outdated Show resolved Hide resolved
@mannycarrera4 mannycarrera4 added this to In progress in Current Sprint (7/20 - 8/9) via automation Dec 19, 2019
@lychyi lychyi mentioned this pull request Dec 28, 2019
31 tasks
@cypress
Copy link

cypress bot commented Jan 7, 2020



Test summary

144 0 0 0


Run details

Project canvas-kit
Status Passed
Commit 5824333
Started Feb 6, 2020 9:17 PM
Ended Feb 6, 2020 9:20 PM
Duration 02:57 💡
OS Linux Ubuntu Linux - 16.04
Browser Electron 78

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@mannycarrera4 mannycarrera4 changed the title test(radio): Add tests and convert them to RTL test(radio): Change tests to react-testing-library and improve coverage Jan 13, 2020
@mannycarrera4 mannycarrera4 marked this pull request as ready for review January 13, 2020 21:32
cypress/integration/Radio.spec.ts Outdated Show resolved Hide resolved
cypress/integration/Radio.spec.ts Outdated Show resolved Hide resolved
modules/form-field/react/stories/stories_Radio.tsx Outdated Show resolved Hide resolved
modules/form-field/react/stories/stories_Radio.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/RadioGroup.spec.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/RadioGroup.spec.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/RadioGroup.spec.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/RadioGroup.spec.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/RadioGroup.spec.tsx Show resolved Hide resolved
}
const id = $label.attr('for');
try {
const $input = Cypress.$(`[id="${id}"]`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we worried that this doesn't account for wrapping labels?

i.e.

<label> 
  <input />
</label>

cypress/integration/Radio.spec.ts Outdated Show resolved Hide resolved
});

it('should pass accessibility checks', () => {
cy.checkA11y();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random point of discussion: it really bugs me how much of a black box this is. For example, Radio group labels need to be legends - does this check that? Does this ensure aria-describedby is set when there's an error? I have no clue. In general, it makes the a11y specs really unclear. Not sure what the solution is without manually checking it all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked Accessibility this question a few months ago. They estimate axe-core catches around 13% of accessibility issues. They think we should run it because it is so cheap to do so, but not treat it as a replacement for accessibility specifications.

What you describe should be specifications in our Cypress files.

describe('given the Error story is rendered', () => {
  it('should have a legend element', () => {
    // get radio input
    // .parents('legend').should('exist')
  })

  it('should have an aria-describedby linking to the input element', () => {
    // find radio input and get id to check against the value of the `aria-describedby`
  })
})

I think the test block description is misleading. It should say something like:

it('should pass axe-core checks', () => {

To clarify:
cy.checkA11y() is not a replacement for accessibility specifications. We simply treat it as a black box and not care if we duplicate accessibility checks.

modules/form-field/react/stories/stories_Radio.tsx Outdated Show resolved Hide resolved
modules/form-field/react/stories/stories_Radio.tsx Outdated Show resolved Hide resolved
modules/form-field/react/stories/stories_Radio.tsx Outdated Show resolved Hide resolved
modules/form-field/react/stories/stories_Radio.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/Radio.spec.tsx Outdated Show resolved Hide resolved
modules/radio/react/spec/RadioGroup.spec.tsx Outdated Show resolved Hide resolved
mannycarrera4 and others added 16 commits February 4, 2020 13:18
…overage (#390)

* test(text-input): Switch tests to RTL

* test(text-input): Add static state for testing

* test(text-input): Update tests

* test(text-input): Update story name

* test(text-input): Fix test

* test(text-input): Fix test

* test(text-input): Fix test

* test(text-input): Fix test

* test(text-input): Update placeholder test

* test(text-input): Update input ref test

* test(text-input): Fix lint

* test(text-input): Update component state table

* fix(text-input): Fix border for disabled text inputs in error

* test(text-input): Add cypress test for typing into field

* chore: Remove unnecessary depth from imports

* test(text-input): Clean up and add RTL tests

Co-authored-by: Alex Nicholls <anicholls3@gmail.com>
Co-authored-by: Alex Nicholls <anicholls3@gmail.com>
cypress/tsconfig.json Outdated Show resolved Hide resolved
@NicholasBoll NicholasBoll dismissed anicholls’s stale review February 6, 2020 21:24

It looks like all requested changes were implemented

@NicholasBoll NicholasBoll merged commit 3e91eac into Workday:master Feb 6, 2020
Current Sprint (7/20 - 8/9) automation moved this from In progress (PRs) to Done Feb 6, 2020
@jpante jpante added this to the Component Testing Coverage milestone Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants