35 lines
786 B
JavaScript
35 lines
786 B
JavaScript
import { shallowMount } from "@vue/test-utils";
|
|
import textInput from "./text-input";
|
|
|
|
describe("text-input.vue", () => {
|
|
it("Should render a text input", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(textInput, {
|
|
propsData: {
|
|
name: "test",
|
|
label: "unit test label",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("input");
|
|
|
|
expect(input.exists()).toBe(true);
|
|
});
|
|
|
|
it("Should return aria-required state", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(textInput, {
|
|
propsData: {
|
|
name: "test",
|
|
label: "unit test label",
|
|
isRequired: true,
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("input");
|
|
|
|
expect(input.attributes()["aria-required"]).toEqual("true");
|
|
});
|
|
});
|