From e7fb39a3fb493c540c38f8396aa11f7f345c6c70 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Tue, 8 Nov 2022 08:18:44 -0500 Subject: [PATCH 1/2] commit --- src/ux-components/checkbox/checkbox.spec.js | 0 src/ux-components/checkbox/checkbox.vue | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/ux-components/checkbox/checkbox.spec.js create mode 100644 src/ux-components/checkbox/checkbox.vue diff --git a/src/ux-components/checkbox/checkbox.spec.js b/src/ux-components/checkbox/checkbox.spec.js new file mode 100644 index 00000000..e69de29b diff --git a/src/ux-components/checkbox/checkbox.vue b/src/ux-components/checkbox/checkbox.vue new file mode 100644 index 00000000..e69de29b From d78da12a98d69cfdec15aee706d6e98cf568e4a4 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Tue, 8 Nov 2022 08:25:12 -0500 Subject: [PATCH 2/2] commit --- src/ux-components/checkbox/checkbox.spec.js | 78 +++++++++++++++++++++ src/ux-components/checkbox/checkbox.vue | 65 +++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/src/ux-components/checkbox/checkbox.spec.js b/src/ux-components/checkbox/checkbox.spec.js index e69de29b..e231ecc7 100644 --- a/src/ux-components/checkbox/checkbox.spec.js +++ b/src/ux-components/checkbox/checkbox.spec.js @@ -0,0 +1,78 @@ +import { shallowMount } from "@vue/test-utils"; +import checkbox from "./checkbox"; +import { nextTick } from "vue"; + +describe("checkbox.vue", () => { + it("Should return checkbox name", async () => { + // Act + const wrapper = shallowMount(checkbox, { + propsData: { + checkboxName: "Checkbox", + }, + }); + + // Assert + const input = wrapper.find("input"); + + // Expect + expect(input.attributes().name).toEqual("Checkbox"); + }); + + it("Should return checkbox id", async () => { + // Act + const wrapper = shallowMount(checkbox, { + propsData: { + buttonID: "Checkbox ID", + }, + }); + + // Assert + const input = wrapper.find("input"); + + // Expect + expect(input.attributes().id).toEqual("Checkbox ID"); + }); + + it("Should return tabindex value", async () => { + // Act + const wrapper = shallowMount(checkbox, { + propsData: { + tabIndex: "1", + }, + }); + + // Assert + const input = wrapper.find("input"); + + // Expect + expect(input.attributes().tabindex).toEqual("1"); + }); + + it("Should return label text", async () => { + // Act + const wrapper = shallowMount(checkbox, { + propsData: { + checkboxLabel: "label text", + }, + }); + + // Assert + const paragraph = wrapper.find("p"); + + expect(paragraph.text()).toEqual("label text"); + }); + + it("Should return label text", async () => { + // Act + const wrapper = shallowMount(checkbox, { + propsData: { + screenReaderOnlyText: "screenreader text", + }, + }); + + // Assert + const paragraph = wrapper.find("span"); + + expect(paragraph.text()).toEqual("screenreader text"); + }); +}); diff --git a/src/ux-components/checkbox/checkbox.vue b/src/ux-components/checkbox/checkbox.vue index e69de29b..cbc1120c 100644 --- a/src/ux-components/checkbox/checkbox.vue +++ b/src/ux-components/checkbox/checkbox.vue @@ -0,0 +1,65 @@ + + + + +