.gitignore and v0.2.0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { fireEvent, render } from "@testing-library/vue";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { h } from "vue";
|
||||
import DsTabs from "../src/components/navigation/DsTabs.vue";
|
||||
|
||||
describe("DsTabs", () => {
|
||||
@@ -29,4 +30,26 @@ describe("DsTabs", () => {
|
||||
});
|
||||
expect(view.emitted()["update:modelValue"]?.at(-1)).toEqual(["billing"]);
|
||||
});
|
||||
|
||||
it("keeps tab and panel relationships unique across instances", () => {
|
||||
const props = {
|
||||
label: "Cuenta",
|
||||
modelValue: "profile",
|
||||
items: [{ id: "profile", label: "Perfil" }],
|
||||
};
|
||||
const view = render({
|
||||
setup: () => () =>
|
||||
h("div", [
|
||||
h(DsTabs, props, { profile: () => "Perfil" }),
|
||||
h(DsTabs, props, { profile: () => "Perfil" }),
|
||||
]),
|
||||
});
|
||||
const [firstTab, secondTab] = view.getAllByRole("tab");
|
||||
const [firstPanel, secondPanel] = view.getAllByRole("tabpanel");
|
||||
|
||||
expect(firstTab?.id).not.toBe(secondTab?.id);
|
||||
expect(firstPanel?.id).not.toBe(secondPanel?.id);
|
||||
expect(firstTab?.getAttribute("aria-controls")).toBe(firstPanel?.id);
|
||||
expect(firstPanel?.getAttribute("aria-labelledby")).toBe(firstTab?.id);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user