Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions ui/src/components/Label/__tests__/Label.test.ts
Original file line number Diff line number Diff line change
@@ -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);
});
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Label renders correctly 1`] = `
<span
class="fd-label fd-label--warning"
>
Label
</span>
`;