-
Notifications
You must be signed in to change notification settings - Fork 89
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 useTheme hook #2625
base: livekit
Are you sure you want to change the base?
Test useTheme hook #2625
Conversation
ec6fdcf
to
4f5badb
Compare
4f5badb
to
777142f
Compare
vi.spyOn(document.body.classList, "add").mockImplementation(vi.fn()); | ||
vi.spyOn(document.body.classList, "remove").mockImplementation(vi.fn()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally .mockImplementation(() => {})
or .mockImplementation(vi.fn())
is a no-op, so these can likely be
vi.spyOn(document.body.classList, "add").mockImplementation(vi.fn()); | |
vi.spyOn(document.body.classList, "remove").mockImplementation(vi.fn()); | |
vi.spyOn(document.body.classList, "add"); | |
vi.spyOn(document.body.classList, "remove"); |
|
||
vi.spyOn(document.body.classList, "add").mockImplementation(vi.fn()); | ||
vi.spyOn(document.body.classList, "remove").mockImplementation(vi.fn()); | ||
vi.spyOn(document.body.classList, "item").mockImplementation(() => null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vi.spyOn(document.body.classList, "item").mockImplementation(() => null); | |
vi.spyOn(document.body.classList, "item").mockReturnValue(null); |
expect(originalClassList.add).toHaveBeenCalledWith("cpd-theme-dark-hc"); | ||
}); | ||
|
||
test("should apply light-high-contrast theme when theme is set to light-high-contrast", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking, but this and the above tests are very similar, so test.each
could make them a lot shorter
No description provided.