Skip to content

Commit

Permalink
test(switch): add switch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek committed Jun 18, 2024
1 parent 4f71759 commit 98d1b1d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/oruga/src/components/switch/tests/switch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ describe("OSwitch tests", () => {
expect(wrapper.classes("o-switch--danger")).toBeTruthy();
});

test("render accordingly when has passiveVariant prop", () => {
const wrapper = mount(OSwitch, {
props: { passiveVariant: "danger" },
});

expect(wrapper.classes("o-switch--danger-passive")).toBeTruthy();
});

test("render accordingly when has rounded prop", () => {
const wrapper = mount(OSwitch, {
props: { rounded: true },
});

const span1 = wrapper.find("span.o-switch__check");
expect(span1.exists()).toBeTruthy();
expect(span1.classes("o-switch--rounded")).not.toBeUndefined();

const span2 = wrapper.find("span.o-switch__check-switch");
expect(span2.exists()).toBeTruthy();
expect(span2.classes("o-switch--rounded")).not.toBeUndefined();
});

test("render accordingly when is disabled", () => {
const wrapper = mount(OSwitch, {
props: { disabled: true },
Expand Down

0 comments on commit 98d1b1d

Please sign in to comment.