Merge branch 'release/2025.01.16' into feature/CASH-77
This commit is contained in:
commit
c148580a03
5 changed files with 114 additions and 4 deletions
|
|
@ -0,0 +1,51 @@
|
|||
import { mount, shallowMount } from "@vue/test-utils";
|
||||
import saveProgressModalQuestion from "./save-progress-modal-question";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
|
||||
jest.mock("@/digital-components/modal/modal", () => ({
|
||||
methods: {
|
||||
openModal: jest.fn(),
|
||||
resetButtonStyle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
describe("save-progress-modal-question ", () => {
|
||||
describe("when openModal is run ", () => {
|
||||
test("the modal should open ", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({
|
||||
props: {
|
||||
modelValue: "",
|
||||
modalWidgetName: "testModal",
|
||||
},
|
||||
});
|
||||
|
||||
// Act
|
||||
wrapper.vm.openModal();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.modal).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({ options, props }) {
|
||||
const mountOptions = getMountOptions({
|
||||
...options,
|
||||
});
|
||||
|
||||
const mockBaseMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn(),
|
||||
dispatchStoreAction: jest.fn(),
|
||||
},
|
||||
};
|
||||
|
||||
if (props) mountOptions.propsData = props;
|
||||
|
||||
mountOptions.global.mixins = [mockBaseMixin];
|
||||
|
||||
const wrapper = mount(saveProgressModalQuestion, mountOptions);
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
@ -78,8 +78,6 @@ export default {
|
|||
this.modal.resetButtonStyle();
|
||||
},
|
||||
async saveProgress() {
|
||||
console.log("Saving Progress! userInput is: ", this.userInput);
|
||||
|
||||
// save email address to store
|
||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.userInput, false);
|
||||
|
||||
|
|
@ -154,6 +152,27 @@ export default {
|
|||
transition: background 0s 0s ease-in-out;
|
||||
}
|
||||
}
|
||||
:deep(.alert) {
|
||||
border-radius: $border-radius-lg;
|
||||
border: 1px solid $green;
|
||||
}
|
||||
:deep(.alert-heading) {
|
||||
position: relative;
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
color: $black;
|
||||
text-align: left;
|
||||
padding-left: 1.5rem;
|
||||
&::before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath fill='%230C7E47' d='M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm3.7 6.171-4.449 4.45a.559.559 0 0 1-.8 0l-2.16-2.16a.563.563 0 0 1 .792-.8l1.76 1.76 4.066-4.042a.563.563 0 1 1 .792.8v-.008Z'/%3E%3C/svg%3E");
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
top: 6px;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.applied-promo {
|
||||
font-size: 0.875rem;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import { shallowMount } from "@vue/test-utils";
|
||||
import saveProgressQuestion from "./save-progress-question";
|
||||
|
||||
describe("save-progress-question.vue", () => {
|
||||
it("Should get the modelValue", async () => {
|
||||
// Arrange
|
||||
const text = "test";
|
||||
const wrapper = shallowMount(saveProgressQuestion, {
|
||||
props: {
|
||||
modelValue: text,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
||||
// Act
|
||||
const modelValueText = wrapper.vm.value;
|
||||
wrapper.vm.value = "test also";
|
||||
|
||||
// Assert
|
||||
expect(modelValueText).toEqual("test");
|
||||
});
|
||||
|
||||
it("Should emit to set value", async () => {
|
||||
// Arrange
|
||||
const text = "test";
|
||||
const wrapper = shallowMount(saveProgressQuestion, {
|
||||
props: {
|
||||
modelValue: text,
|
||||
},
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
||||
// Act
|
||||
const modelValueText = wrapper.vm.value;
|
||||
wrapper.vm.value = "test also";
|
||||
|
||||
// Assert
|
||||
expect(wrapper.emitted("update:modelValue")).toEqual([["test also"]]);
|
||||
});
|
||||
});
|
||||
|
|
@ -160,7 +160,7 @@ export default {
|
|||
);
|
||||
},
|
||||
saveProgress() {
|
||||
saveQuote({ pageNameToLog: "part-questions" });
|
||||
saveQuote({ pageNameToLog: "capability-questions" });
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
const questionAnswersArray = this.questionsData.map((glass) => {
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ export default {
|
|||
);
|
||||
},
|
||||
saveProgress() {
|
||||
saveQuote({ pageNameToLog: "part-questions" });
|
||||
saveQuote({ pageNameToLog: "molding-questions" });
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
const questionAnswersArray = this.questionsData.map((glass) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue