Check out a free preview of the full Accessibility in JavaScript Applications course:
The "Unit Testing Exercise" Lesson is part of the full, Accessibility in JavaScript Applications course featured in this preview video. Here's what you'd learn in this lesson:

Marcy instructs students to create accessibility unit tests for either the Jest framework or the Jasmine framework.

Get Unlimited Access Now

Transcript from the "Unit Testing Exercise" Lesson

>> Marcy Sutton: I want you to raise some unit test now. And so that test shell is in. I am gonna push those tests that I wrote up cuz since I accidentally deleted them earlier. They will be in the examples directory, if you want to refer to them. Otherwise, in the better components directory, there is a starter test.

[00:00:19] I also have another alternative. I have Jasmine implemented here on code pen, which I have to give credit to Brian Holt because he had all of his tests on code pen and it's magical to me. So I had started with that. And there is a modal window here, that if you had a Modal component that you needed to test that it opened, it makes sense to me in a unit test.

[00:00:46] But it is kind of annoying when it automates cuz it's the finished example, you'll be like, whoa, that automated it and really opened the Modal window. [LAUGH] I think that's okay. But I don't think it needs a load and integration test land. But this is an example. I guess it has.

[00:01:03] This has the setup. So the motor dialog is added here in this mark up, it's kind of just like a quick and dirty way to add it. But then the assertion here are blanks. So that's an alternative if you wanna play with that instead of just.