DigitalConsumer.FixMyGlass/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js
2021-12-15 13:32:10 -05:00

46 lines
1.3 KiB
JavaScript

import { shallowMount } from "@vue/test-utils";
import listButtonHorizontal from "./list-button-horizontal";
describe("list-button.vue", () => {
it("Should render the 'buttonID' prop value as the label and id value as well as the button value, groupName as the name value, and fire a click even that sets the display data attribute to true.", async () => {
// Act
const wrapper = shallowMount(listButtonHorizontal, {
propsData: {
buttonID: "2023",
groupName: "TestGroup",
loaderColor: "blue",
loaderPosition: "right",
sizeInRem: "1.5",
errorMessage: "null",
},
});
// Assert
const input = wrapper.find("input");
const label = wrapper.find("label");
const paragraph = wrapper.find("span");
await label.trigger("click");
expect(input.attributes()).toEqual({
id: "2023",
type: "radio",
value: "2023",
name: "TestGroup",
"aria-required": "true",
});
expect(label.attributes()).toEqual({
tabindex: "-1",
for: "2023",
class: "d-flex flex-column justify-content-center py-3 px-4 last-item",
"aria-checked": "false",
});
expect(label.text()).toEqual("2023");
expect(paragraph.text()).toEqual("2023");
expect(wrapper.vm.isLoaderDisplayed).toBe(true);
});
});