63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
import { shallowMount } from "@vue/test-utils";
|
|
import radio from "./radio";
|
|
import { nextTick } from "vue";
|
|
|
|
describe("radio.vue", () => {
|
|
it("Should return group name", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(radio, {
|
|
propsData: {
|
|
groupName: "radio-button-test",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("input");
|
|
|
|
// Expect
|
|
expect(input.attributes().name).toEqual("radio-button-test");
|
|
});
|
|
|
|
it("Should return checkbox id", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(radio, {
|
|
propsData: {
|
|
buttonID: "Radio ID",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const input = wrapper.find("input");
|
|
|
|
// Expect
|
|
expect(input.attributes().id).toEqual("Radio ID");
|
|
});
|
|
|
|
it("Should return label text", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(radio, {
|
|
propsData: {
|
|
buttonLabel: "label text",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const paragraph = wrapper.find("p");
|
|
|
|
expect(paragraph.text()).toEqual("label text");
|
|
});
|
|
|
|
it("Should return label text", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(radio, {
|
|
propsData: {
|
|
screenReaderOnlyText: "screenreader text",
|
|
},
|
|
});
|
|
|
|
// Assert
|
|
const paragraph = wrapper.find("span");
|
|
|
|
expect(paragraph.text()).toEqual("screenreader text");
|
|
});
|
|
});
|