81 lines
1.7 KiB
JavaScript
81 lines
1.7 KiB
JavaScript
import { shallowMount } from "@vue/test-utils";
|
|
import dropdownQuestion from "./dropdown-question";
|
|
import { nextTick } from "vue";
|
|
|
|
describe("dropdownQuestion.vue", () => {
|
|
|
|
it("Should return aria-disabled state", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(dropdownQuestion, {
|
|
propsData: {
|
|
isDisabled: true,
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("select");
|
|
|
|
// Expect
|
|
expect(input.attributes()["aria-disabled"]).toEqual("true");
|
|
});
|
|
|
|
it("Should render a text input", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(dropdownQuestion, {
|
|
propsData: {
|
|
name: "test",
|
|
label: "unit test label",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("select");
|
|
|
|
expect(input.exists()).toBe(true);
|
|
});
|
|
|
|
it("Should return input id", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(dropdownQuestion, {
|
|
propsData: {
|
|
inputId: "input ID",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("select");
|
|
|
|
// Expect
|
|
expect(input.attributes().id).toEqual("input ID");
|
|
});
|
|
|
|
it("Should return label text", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(dropdownQuestion, {
|
|
propsData: {
|
|
labelText: "label text",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const label = wrapper.find("label");
|
|
|
|
expect(label.text()).toEqual("label text");
|
|
});
|
|
|
|
it("Should return input id", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(dropdownQuestion, {
|
|
propsData: {
|
|
inputId: "input ID",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("select");
|
|
|
|
// Expect
|
|
expect(input.attributes().id).toEqual("input ID");
|
|
});
|
|
|
|
});
|