From dce65c3270158303b877aee176ad17529c0a5f7f Mon Sep 17 00:00:00 2001 From: mlmoravek Date: Mon, 9 Dec 2024 16:51:54 +0100 Subject: [PATCH] test: fix tests --- packages/oruga/src/components/tabs/TabItem.vue | 2 +- .../tabs/tests/tabs.integration.test.ts | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/oruga/src/components/tabs/TabItem.vue b/packages/oruga/src/components/tabs/TabItem.vue index 19c4f93bd..224796893 100644 --- a/packages/oruga/src/components/tabs/TabItem.vue +++ b/packages/oruga/src/components/tabs/TabItem.vue @@ -49,7 +49,7 @@ const providedData = computed>(() => ({ value: itemValue, $slots: slots, navClasses: navItemClasses.value, - classes: tabClasses.value, + tabClasses: tabClasses.value, iconClasses: tabIconClasses.value, labelClasses: tabLabelClasses.value, isTransitioning: isTransitioning.value, diff --git a/packages/oruga/src/components/tabs/tests/tabs.integration.test.ts b/packages/oruga/src/components/tabs/tests/tabs.integration.test.ts index ba8f9611d..46468af69 100644 --- a/packages/oruga/src/components/tabs/tests/tabs.integration.test.ts +++ b/packages/oruga/src/components/tabs/tests/tabs.integration.test.ts @@ -66,7 +66,7 @@ describe("OTab with OTabItem tests", () => { test("renders the tab buttons", async () => { const wrapper = mount(componentWrapper); - await wrapper.vm.$nextTick(); + await nextTick(); const tabButtons = wrapper.findAll(".o-tabs__nav-item"); @@ -81,7 +81,7 @@ describe("OTab with OTabItem tests", () => { test("renders the tab panels", async () => { const wrapper = mount(componentWrapper, { attachTo: document.body }); - await wrapper.vm.$nextTick(); + await nextTick(); const tabPanls = wrapper.findAll(`[data-oruga="tabs-item"]`); @@ -96,22 +96,24 @@ describe("OTab with OTabItem tests", () => { test("switches the content based on the tab clicked", async () => { const wrapper = mount(componentWrapper, { attachTo: document.body }); - await wrapper.vm.$nextTick(); + await nextTick(); const tabs = wrapper.findAll(".o-tabs__tab"); - const tabPanls = wrapper.findAll(`[data-oruga="tabs-item"]`); + const tabPanels = wrapper.findAll(`[data-oruga="tabs-item"]`); + expect(tabs).toHaveLength(3); + expect(tabPanels).toHaveLength(3); // clicking the second tab reveals the second content // and hides the first content await tabs[1].trigger("click"); - expect(tabPanls[1].isVisible()).toBeTruthy(); - expect(tabPanls[0].isVisible()).toBeFalsy(); + expect(tabPanels[1].isVisible()).toBeTruthy(); + expect(tabPanels[0].isVisible()).toBeFalsy(); // clicking the third tab reveals the third content // and hides the second content await tabs[2].trigger("click"); - expect(tabPanls[2].isVisible()).toBeTruthy(); - expect(tabPanls[1].isVisible()).toBeFalsy(); + expect(tabPanels[2].isVisible()).toBeTruthy(); + expect(tabPanels[1].isVisible()).toBeFalsy(); }); test("render item with component prop correctly", () => {