diff --git a/src/digital-components/modal/modal.spec.js b/src/digital-components/modal/modal.spec.js
index 2664accf..e4d8692d 100644
--- a/src/digital-components/modal/modal.spec.js
+++ b/src/digital-components/modal/modal.spec.js
@@ -1,68 +1,255 @@
+jest.mock("vee-validate", () => ({
+ useForm: jest.fn(),
+}));
+
+const mockValidate = (returnValue) => jest.fn(async () => Promise.resolve({ valid: returnValue }));
+const mockMeta = (returnValue) => jest.fn(async () => Promise.resolve(returnValue));
+
import { shallowMount } from "@vue/test-utils";
-import Modal from "./modal";
+import modal from "./modal";
+import crypto from "crypto";
+import { useForm } from "vee-validate";
+import { Modal } from "bootstrap";
+
+const footerButtonText = "Sample footer text here.";
+const headerText = "Sample header text here.";
+
+global.crypto = crypto;
describe("modal.vue", () => {
- it("Should display header text when HeaderText is defined in the CMS", async () => {
- // Act
- const wrapper = shallowMount(Modal, {
- mixins: [mockMixin],
+ it("Should display modal header text when headerText is defined", async () => {
+ // Arrange / Act
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+
+ const wrapper = shallowMount(modal, {
props: {
- cmsWidgetName: "test",
+ headerText: headerText,
+ footerButtonText: footerButtonText,
},
attachTo: document.body,
});
- expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["HeaderText"]));
+
+ // Assert
+ expect(wrapper.html()).toEqual(expect.stringContaining(headerText));
});
- it("Should display subheader text when SubheaderText is defined in the CMS", async () => {
- // Act
- const wrapper = shallowMount(Modal, {
- mixins: [mockMixin],
+ it("Should display footer button text when footerButtonText is defined", async () => {
+ // Arrange / Act
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+ const wrapper = shallowMount(modal, {
props: {
- cmsWidgetName: "test",
+ footerButtonText: footerButtonText,
},
attachTo: document.body,
});
- expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["SubheaderText"]));
+
+ // Assert
+ expect(wrapper.html()).toEqual(expect.stringContaining(footerButtonText));
});
- it("Should insert image url when Image is defined in the CMS", async () => {
- // Act
- const wrapper = shallowMount(Modal, {
- mixins: [mockMixin],
+ it("Should emit 'footer-button-event' if the form is valid", async () => {
+ // Arrange
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+
+ const resetButtonStyle = jest.fn();
+ const wrapper = shallowMount(modal, {
props: {
- cmsWidgetName: "test",
+ footerButtonText: footerButtonText,
+ headerText: headerText,
},
attachTo: document.body,
});
- expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["Image"]));
+ wrapper.vm.resetButtonStyle = resetButtonStyle;
+
+ // Act
+ const buttonMain = wrapper.findComponent({ ref: "modalButtonMain" });
+ await buttonMain.trigger("click-event");
+
+ // Assert
+ expect(wrapper.emitted("footer-button-event")).toBeTruthy();
});
- it("Should display body text when BodyText is defined in the CMS", async () => {
- // Act
- const wrapper = shallowMount(Modal, {
- mixins: [mockMixin],
+ it("Should not emit 'footer-button-event' if the form is invalid", async () => {
+ // Arrange
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: false,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(false),
+ });
+
+ const resetButtonStyle = jest.fn();
+ const wrapper = shallowMount(modal, {
props: {
- cmsWidgetName: "test",
+ footerButtonText: footerButtonText,
+ headerText: headerText,
},
attachTo: document.body,
});
- expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["BodyText"]));
+ wrapper.vm.resetButtonStyle = resetButtonStyle;
+
+ // Act
+ const buttonMain = wrapper.findComponent({ ref: "modalButtonMain" });
+ await buttonMain.trigger("click-event");
+
+ // Assert
+ expect(wrapper.emitted("footer-button-event")).toBeFalsy();
+ });
+
+ it("Should have a disabled footer button when the form has not been touched", async () => {
+ // Arrange / Act
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+
+ const resetButtonStyle = jest.fn();
+ const wrapper = shallowMount(modal, {
+ props: {
+ footerButtonText: footerButtonText,
+ headerText: headerText,
+ },
+ attachTo: document.body,
+ });
+ wrapper.vm.resetButtonStyle = resetButtonStyle;
+
+ // Assert
+ expect(wrapper.vm.isFooterButtonDisabled).toBe(true);
+ });
+
+ it("Should have a disabled footer button when the form is invalid", async () => {
+ // Arrange / Act
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+
+ const resetButtonStyle = jest.fn();
+ const wrapper = shallowMount(modal, {
+ props: {
+ footerButtonText: footerButtonText,
+ headerText: headerText,
+ },
+ attachTo: document.body,
+ });
+ wrapper.vm.resetButtonStyle = resetButtonStyle;
+
+ // Assert
+ expect(wrapper.vm.isFooterButtonDisabled).toBe(true);
+ });
+
+ it("Should call bootstrap Modal method 'show' when calling 'openModal'", async () => {
+ // Arrange
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+
+ const showMock = jest.spyOn(Modal.prototype, "show");
+
+ const resetButtonStyle = jest.fn();
+ const wrapper = shallowMount(modal, {
+ props: {
+ footerButtonText: footerButtonText,
+ headerText: headerText,
+ },
+ attachTo: document.body,
+ });
+ wrapper.vm.resetButtonStyle = resetButtonStyle;
+
+ // Act
+ wrapper.vm.openModal();
+
+ // Assert
+ expect(showMock).toHaveBeenCalled();
+ });
+
+ it("Should call bootstrap Modal method 'hide' when calling 'closeModal'", async () => {
+ // Arrange
+ const fakeMeta = {
+ touched: true,
+ dirty: true,
+ valid: true,
+ validated: true,
+ };
+
+ useForm.mockReturnValue({
+ meta: mockMeta(fakeMeta),
+ validate: mockValidate(true),
+ });
+ const hideMock = jest.spyOn(Modal.prototype, "hide");
+
+ const resetButtonStyle = jest.fn();
+ const wrapper = shallowMount(modal, {
+ props: {
+ footerButtonText: footerButtonText,
+ headerText: headerText,
+ },
+ attachTo: document.body,
+ });
+ wrapper.vm.resetButtonStyle = resetButtonStyle;
+
+ // Act
+ wrapper.vm.openModal();
+ wrapper.vm.closeModal();
+
+ // Assert
+ expect(hideMock).toHaveBeenCalled();
});
});
-
-const mockMixin = {
- methods: {
- getCmsContent: jest.fn((widgetName, cmsFieldName) => {
- return mockCmsContent[cmsFieldName];
- }),
- },
-};
-
-const mockCmsContent = {
- HeaderText: "Sample header text here.",
- SubheaderText: "Sample subheader text here.",
- Image: "https://www.sampleImage.sample",
- BodyText: "Sample body text here.",
- FooterText: "Sample footer text here.",
-};
diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue
index 8d961830..fb06197d 100644
--- a/src/digital-components/modal/modal.vue
+++ b/src/digital-components/modal/modal.vue
@@ -2,39 +2,38 @@
-
@@ -42,46 +41,80 @@
\ No newline at end of file
+
diff --git a/src/helpers/cms-content-helper.js b/src/helpers/cms-content-helper.js
index 36bf7c70..656b2b5f 100644
--- a/src/helpers/cms-content-helper.js
+++ b/src/helpers/cms-content-helper.js
@@ -173,9 +173,14 @@ function mapStringToModal(str) {
let params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length -1)
let splitParams = params.split(",");
- let bodyText = '
' + splitParams[1] +''
-
- return str.replace(linkToReplace, bodyText);
+
+ let bodyText = '
' + splitParams[1] + ''
+ let returnVal = str.replace(linkToReplace, bodyText)
+
+ if (returnVal.includes(dynamicStrings.MODAL_LINK)) {
+ returnVal = mapStringToModal(returnVal);
+ }
+ return returnVal;
}
// Function to convert a string, into a matching global state item.
@@ -214,7 +219,20 @@ function mapStringToState(str) {
}
return stringBuilder.trimStart();
- }
+}
+
+export function setupModalLinks(context) {
+ context.$nextTick(() => {
+ const elements = document.getElementsByClassName("modal-text")
+ for(let element of elements){
+ const target = element.getAttribute("modalTarget");
+ if(target)
+ {
+ element.addEventListener("click", () => context.$refs[target].openModal() );
+ }
+ };
+ });
+}
export function doesCopyContainRouterLink(copy) {
return copy.includes(this.dynamicStrings.ROUTER_LINK);
diff --git a/src/helpers/unit-test-helper.js b/src/helpers/unit-test-helper.js
index 42b5db66..6efc2491 100644
--- a/src/helpers/unit-test-helper.js
+++ b/src/helpers/unit-test-helper.js
@@ -48,6 +48,8 @@ export function getMountOptions(mockData) {
mocks.queryStrings = queryStrings;
mocks.$router = mockData?.router;
mocks.$route = mockData?.route;
+ mocks.GaActions = GaActions;
+ mocks.pushEventToGA = jest.fn();
mocks.$loadScript = mockData?.loadScript;
mocks.prependActionToMethod = jest.fn();
diff --git a/src/iss-components/content-group-modal/content-group-modal.spec.js b/src/iss-components/content-group-modal/content-group-modal.spec.js
new file mode 100644
index 00000000..cbdf6e18
--- /dev/null
+++ b/src/iss-components/content-group-modal/content-group-modal.spec.js
@@ -0,0 +1,67 @@
+import { mount } from "@vue/test-utils";
+import contentGroupModal from "./content-group-modal";
+import crypto from "crypto";
+
+global.crypto = crypto;
+
+describe("content-group-modal.vue", () => {
+ it("Should display header text when HeaderText is defined in the CMS", async () => {
+ const wrapper = mount(contentGroupModal, {
+ mixins: [mockMixin],
+ props: {
+ cmsWidgetName: "test",
+ },
+ attachTo: document.body,
+ });
+ expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["HeaderText"]));
+ });
+
+ it("Should display subheader text when SubheaderText is defined in the CMS", async () => {
+ const wrapper = mount(contentGroupModal, {
+ mixins: [mockMixin],
+ props: {
+ cmsWidgetName: "test",
+ },
+ attachTo: document.body,
+ });
+ expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["SubheaderText"]));
+ });
+
+ it("Should insert image url when Image is defined in the CMS", async () => {
+ const wrapper = mount(contentGroupModal, {
+ mixins: [mockMixin],
+ props: {
+ cmsWidgetName: "test",
+ },
+ attachTo: document.body,
+ });
+ expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["Image"]));
+ });
+
+ it("Should display body text when BodyText is defined in the CMS", async () => {
+ const wrapper = mount(contentGroupModal, {
+ mixins: [mockMixin],
+ props: {
+ cmsWidgetName: "test",
+ },
+ attachTo: document.body,
+ });
+ expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["BodyText"]));
+ });
+});
+
+const mockMixin = {
+ methods: {
+ getCmsContent: jest.fn((widgetName, cmsFieldName) => {
+ return mockCmsContent[cmsFieldName];
+ }),
+ },
+};
+
+const mockCmsContent = {
+ HeaderText: "Sample header text here.",
+ SubheaderText: "Sample subheader text here.",
+ Image: "https://www.sampleImage.sample",
+ BodyText: "Sample body text here.",
+ FooterText: "Sample footer text here.",
+};
diff --git a/src/iss-components/content-group-modal/content-group-modal.vue b/src/iss-components/content-group-modal/content-group-modal.vue
new file mode 100644
index 00000000..d9d9da93
--- /dev/null
+++ b/src/iss-components/content-group-modal/content-group-modal.vue
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/layouts/coverage-statement/coverage-statement.spec.js b/src/layouts/coverage-statement/coverage-statement.spec.js
index 8469daba..6254f006 100644
--- a/src/layouts/coverage-statement/coverage-statement.spec.js
+++ b/src/layouts/coverage-statement/coverage-statement.spec.js
@@ -8,7 +8,7 @@ import { useMainStore } from "@/store";
import baseMixin from "@/mixins/base-mixin";
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
import { applicationConfig } from "@/constants/application-config";
-import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
+import { fetchCmsContentForPage, setupModalLinks } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper.js";
jest.mock("@/helpers/damage-helper", () => ({
@@ -20,9 +20,10 @@ jest.mock("@/helpers/layout-helper.js", () => ({
settleAllPromises: jest.fn(),
}));
-// Mock fetchCmsContentForPage
+// Mock fetchCmsContentForPage, setupModalLinks
jest.mock("@/helpers/cms-content-helper", () => ({
fetchCmsContentForPage: jest.fn(),
+ setupModalLinks: jest.fn(),
}));
describe("coverage-statement.vue...", () => {
diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue
index 5f7a886a..6a52f045 100644
--- a/src/layouts/coverage-statement/coverage-statement.vue
+++ b/src/layouts/coverage-statement/coverage-statement.vue
@@ -1,48 +1,49 @@
-
+
+
\ No newline at end of file
diff --git a/src/layouts/coverage-statement/recal-modal/recal-modal.spec.js b/src/layouts/coverage-statement/recal-modal/recal-modal.spec.js
index 3ab73b9a..0f555171 100644
--- a/src/layouts/coverage-statement/recal-modal/recal-modal.spec.js
+++ b/src/layouts/coverage-statement/recal-modal/recal-modal.spec.js
@@ -1,10 +1,10 @@
-import { shallowMount } from "@vue/test-utils";
+import { shallowMount, mount } from "@vue/test-utils";
import recalModal from "@/layouts/coverage-statement/recal-modal/recal-modal.vue";
describe("modal.vue", () => {
it("Should display header text when HeaderText is defined in the CMS", async () => {
// Act
- const wrapper = shallowMount(recalModal, {
+ const wrapper = mount(recalModal, {
mixins: [mockMixin],
props: {
cmsWidgetName: "test",
@@ -16,7 +16,7 @@ describe("modal.vue", () => {
it("Should display subheader text when SubheaderText is defined in the CMS", async () => {
// Act
- const wrapper = shallowMount(recalModal, {
+ const wrapper = mount(recalModal, {
mixins: [mockMixin],
props: {
cmsWidgetName: "test",
@@ -28,7 +28,7 @@ describe("modal.vue", () => {
it("Should insert image url when Image is defined in the CMS", async () => {
// Act
- const wrapper = shallowMount(recalModal, {
+ const wrapper = mount(recalModal, {
mixins: [mockMixin],
props: {
cmsWidgetName: "test",
@@ -40,7 +40,7 @@ describe("modal.vue", () => {
it("Should display body text when BodyText is defined in the CMS", async () => {
// Act
- const wrapper = shallowMount(recalModal, {
+ const wrapper = mount(recalModal, {
mixins: [mockMixin],
props: {
cmsWidgetName: "test",
diff --git a/src/layouts/coverage-statement/recal-modal/recal-modal.vue b/src/layouts/coverage-statement/recal-modal/recal-modal.vue
index aaed71e6..0a360174 100644
--- a/src/layouts/coverage-statement/recal-modal/recal-modal.vue
+++ b/src/layouts/coverage-statement/recal-modal/recal-modal.vue
@@ -1,55 +1,45 @@
-
-
-
-
-
-
-
-
![]()
-
-
-
-
-
-
+
+
+
+
![]()
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/src/layouts/entry-page/entry-page.vue b/src/layouts/entry-page/entry-page.vue
index 50493570..198cc3bc 100644
--- a/src/layouts/entry-page/entry-page.vue
+++ b/src/layouts/entry-page/entry-page.vue
@@ -146,11 +146,11 @@
break;
case "returnurl":
- this.mainStore.iisConfig.returnURL = value;
+ this.mainStore.issConfig.returnURL = value;
break;
case "returnurl2":
- this.mainStore.iisConfig.returnURL2 = value;
+ this.mainStore.issConfig.returnURL2 = value;
break;
// Not stored
diff --git a/src/layouts/part-questions/part-questions.spec.js b/src/layouts/part-questions/part-questions.spec.js
index 5e2b7d47..e2ab3bd7 100644
--- a/src/layouts/part-questions/part-questions.spec.js
+++ b/src/layouts/part-questions/part-questions.spec.js
@@ -350,7 +350,7 @@ function setupMocks({
],
route: {
query: {
- fmgPage: "part-questions",
+ issPage: "part-questions",
},
},
data() {
diff --git a/src/layouts/provider-preference/provider-preference.vue b/src/layouts/provider-preference/provider-preference.vue
index 11bf45f7..f4064ffa 100644
--- a/src/layouts/provider-preference/provider-preference.vue
+++ b/src/layouts/provider-preference/provider-preference.vue
@@ -14,7 +14,7 @@
v-html="ProviderPreferenceBodyText"
class="mt-0 body-text"
>
-
+
+
diff --git a/src/styles/common-styles.scss b/src/styles/common-styles.scss
index 92f3478d..73e01e30 100644
--- a/src/styles/common-styles.scss
+++ b/src/styles/common-styles.scss
@@ -63,4 +63,11 @@ body {
overflow: hidden;
}
}
-}
+
+ .modal-text {
+ display: inline;
+ color: $blue;
+ cursor: pointer;
+ text-decoration: underline;
+ }
+}
\ No newline at end of file
diff --git a/src/ux-components/list-button/list-button.spec.js b/src/ux-components/list-button/list-button.spec.js
index 3b7d267d..3ed2ba6a 100644
--- a/src/ux-components/list-button/list-button.spec.js
+++ b/src/ux-components/list-button/list-button.spec.js
@@ -11,7 +11,7 @@ describe("list-button.vue", () => {
mockData: {
global: {
mocks: {
- $route: { query: { fmgPage: "page-name" } },
+ $route: { query: { issPage: "page-name" } },
GaActions: GaActions,
pushEventToGA: jest.fn(),
},
@@ -37,7 +37,7 @@ describe("list-button.vue", () => {
mockData: {
global: {
mocks: {
- $route: { query: { fmgPage: "page-name" } },
+ $route: { query: { issPage: "page-name" } },
GaActions: GaActions,
pushEventToGA: jest.fn(),
},
@@ -64,7 +64,7 @@ describe("list-button.vue", () => {
mockData: {
global: {
mocks: {
- $route: { query: { fmgPage: "page-name" } },
+ $route: { query: { issPage: "page-name" } },
GaActions: GaActions,
pushEventToGA: jest.fn(),
},
diff --git a/src/ux-components/modal-button-main/modal-button-main.spec.js b/src/ux-components/modal-button-main/modal-button-main.spec.js
new file mode 100644
index 00000000..621f3d4c
--- /dev/null
+++ b/src/ux-components/modal-button-main/modal-button-main.spec.js
@@ -0,0 +1,188 @@
+import { shallowMount } from "@vue/test-utils";
+import modalButtonMain from "./modal-button-main";
+import { getMountOptions } from "@/helpers/unit-test-helper.js";
+import { nextTick } from "vue";
+
+describe("modal-button-main.vue", () => {
+ it("Should return btn-primary class", () => {
+ // Arrange/Act
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ isPrimary: true,
+ },
+ })
+ );
+ const button = wrapper.find("button");
+
+ // Assert
+ expect(button.attributes("class")).toContain("btn-primary");
+ });
+
+ it("Should return aria-disabled state", () => {
+ // Arrange/Act
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ isDisabled: true,
+ },
+ })
+ );
+ const button = wrapper.find("button");
+
+ // Assert
+ expect(button.attributes()["aria-disabled"]).toEqual("true");
+ });
+
+ it("Should return loader color", async () => {
+ // Arrange
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ loaderColor: "blue",
+ loaderEnabled: true,
+ },
+ })
+ );
+
+ // Act
+ wrapper.vm.clicked();
+
+ await nextTick();
+
+ // Assert
+ const loader = wrapper.find("loader-stub");
+ expect(loader.attributes("class")).toContain("blue");
+ });
+
+ it("Should return loader position", async () => {
+ // Arrange
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ loaderPosition: "right",
+ loaderEnabled: true,
+ },
+ })
+ );
+
+ // Act
+ wrapper.vm.clicked();
+ await nextTick();
+
+ // Assert
+ const loader = wrapper.find("loader-stub");
+ expect(loader.attributes("class")).toContain("right");
+ });
+
+ it("Should set 'isLoaderDisplayed' to false when calling 'removeLoader'", async () => {
+ // Arrange
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ loaderPosition: "right",
+ loaderEnabled: true,
+ },
+ })
+ );
+
+ wrapper.setData({
+ isLoaderDisplayed: true,
+ });
+
+ // Act
+ wrapper.vm.removeLoader();
+ await nextTick();
+
+ // Assert
+ const loader = wrapper.find("loader-stub");
+ expect(wrapper.vm.isLoaderDisplayed).toBe(false);
+ });
+
+ it("Should set 'isLoaderDisplayed' to false when calling 'resetButtonStyle'", async () => {
+ // Arrange
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ loaderPosition: "right",
+ loaderEnabled: true,
+ },
+ })
+ );
+
+ wrapper.setData({
+ isLoaderDisplayed: true,
+ });
+
+ // Act
+ wrapper.vm.resetButtonStyle();
+ await nextTick();
+
+ // Assert
+ expect(wrapper.vm.isLoaderDisplayed).toBe(false);
+ });
+
+ it("Should emit 'click-event' event when clicking if the button is enabled", async () => {
+ // Arrange
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ loaderPosition: "right",
+ loaderEnabled: true,
+ isDisabled: false,
+ },
+ })
+ );
+
+ const buttonElement = wrapper.find("button");
+
+ // Act
+ buttonElement.trigger("click");
+
+ await nextTick();
+
+ // Assert
+ expect(wrapper.emitted("click-event")).toBeTruthy();
+ });
+
+ it("Should not emit 'click-event' event when clicking if the button is disabled", async () => {
+ // Arrange
+ const wrapper = shallowMount(
+ modalButtonMain,
+ setupMocks({
+ propsData: {
+ loaderPosition: "right",
+ loaderEnabled: true,
+ isDisabled: true,
+ },
+ })
+ );
+
+ const buttonElement = wrapper.find("button");
+
+ // Act
+ buttonElement.trigger("click");
+
+ await nextTick();
+
+ // Assert
+ expect(wrapper.emitted("click-event")).toBeFalsy();
+ });
+});
+
+function setupMocks(mountOptionsMockData = {}) {
+ const defaultMountOptions = { route: { query: { issPage: "page-name" } } };
+ const baseMountOptions = getMountOptions(
+ Object.assign(defaultMountOptions, mountOptionsMockData)
+ );
+ const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
+
+ return allMountOptions;
+}
diff --git a/src/ux-components/modal-button-main/modal-button-main.vue b/src/ux-components/modal-button-main/modal-button-main.vue
new file mode 100644
index 00000000..3cf8f7a2
--- /dev/null
+++ b/src/ux-components/modal-button-main/modal-button-main.vue
@@ -0,0 +1,153 @@
+
+
+
+
+
+
+