diff --git a/ui/src/components/Label/__tests__/Label.test.ts b/ui/src/components/Label/__tests__/Label.test.ts new file mode 100644 index 00000000..ff90ba90 --- /dev/null +++ b/ui/src/components/Label/__tests__/Label.test.ts @@ -0,0 +1,57 @@ +import { mount } from "@vue/test-utils"; +import Label from "../Label.vue"; + +describe("Label", () => { + it("renders correctly", () => { + const wrapper = mount(Label, { + propsData: { + type: "warning" + }, + slots: { + default: "Label" + } + }); + expect(wrapper.element).toMatchSnapshot(); + }); + + it("renders correct types", () => { + const labelWarning = mount(Label, { + propsData: { + type: "warning" + }, + slots: { + default: "Label" + } + }); + const labelError = mount(Label, { + propsData: { + type: "error" + }, + slots: { + default: "Label" + } + }); + const labelSuccess = mount(Label, { + propsData: { + type: "success" + }, + slots: { + default: "Label" + } + }); + + expect(labelWarning.classes('fd-label--warning')).toBe(true); + expect(labelError.classes('fd-label--error')).toBe(true); + expect(labelSuccess.classes('fd-label--success')).toBe(true); + }); + + it("renders default slot when passed", () => { + const label = "Label"; + const wrapper = mount(Label, { + slots: { + default: label + } + }); + expect(wrapper.text()).toEqual(label); + }); +}) \ No newline at end of file diff --git a/ui/src/components/Label/__tests__/__snapshots__/Label.test.ts.snap b/ui/src/components/Label/__tests__/__snapshots__/Label.test.ts.snap new file mode 100644 index 00000000..9066742e --- /dev/null +++ b/ui/src/components/Label/__tests__/__snapshots__/Label.test.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Label renders correctly 1`] = ` + + Label + +`;