From b15d1b5ced61d3c14c7afc7fa80fa8e474b7401a Mon Sep 17 00:00:00 2001 From: enzoggqs Date: Wed, 11 Jan 2023 13:16:23 -0300 Subject: [PATCH] Create first custom button tests --- .../__tests__/CustomButton.spec.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/components/CustomButton/__tests__/CustomButton.spec.ts diff --git a/src/components/CustomButton/__tests__/CustomButton.spec.ts b/src/components/CustomButton/__tests__/CustomButton.spec.ts new file mode 100644 index 0000000..f43c5fa --- /dev/null +++ b/src/components/CustomButton/__tests__/CustomButton.spec.ts @@ -0,0 +1,27 @@ +import { mount } from "@vue/test-utils"; +import CustomButton from "../CustomButton.vue"; + +describe("CustomButton.vue", () => { + test("Test button content", () => { + const wrapper = mount(CustomButton, { + props: { + text: "Testing", + }, + }); + + expect(wrapper.html()).toContain("Testing"); + }); + + test("Test if disabled props works", () => { + const wrapper = mount(CustomButton, { + props: { + isDisabled: true, + }, + }); + + //@ts-ignore + const button = wrapper.find(".button") as HTMLButtonElement; + //@ts-ignore + expect(button.element.disabled).toBe(true); + }); +});