Merge pull request #887 from Safelite/feature/CSR-803-refactoring-2
CSR-938: fix vehicle-parts back button
This commit is contained in:
commit
cbd6dcfff4
5 changed files with 48 additions and 40 deletions
|
|
@ -2,14 +2,6 @@ import { shallowMount, mount } from "@vue/test-utils";
|
||||||
import buttonQuestion from "@/common-components/button-question/button-question";
|
import buttonQuestion from "@/common-components/button-question/button-question";
|
||||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
|
|
||||||
jest.mock(
|
|
||||||
"@/store",
|
|
||||||
() => {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
{ virtual: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
describe("buttonQuestion.vue", () => {
|
describe("buttonQuestion.vue", () => {
|
||||||
it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => {
|
it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => {
|
||||||
// Act
|
// Act
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ describe("dropdownQuestion.vue", () => {
|
||||||
mixins: [mockMixin],
|
mixins: [mockMixin],
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapper.getCmsContent = jest.fn();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const select = wrapper.find("select");
|
const select = wrapper.find("select");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
:isForwardActionDisabled="isForwardActionDisabled"
|
:isForwardActionDisabled="isForwardActionDisabled"
|
||||||
@back-click="navigateBack"
|
@back-clicked="navigateBack"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,89 +4,77 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
import { nextTick } from "vue";
|
import { nextTick } from "vue";
|
||||||
|
|
||||||
describe("buttonMain.vue", () => {
|
describe("buttonMain.vue", () => {
|
||||||
it("Should return btn-primary class", async () => {
|
it("Should return btn-primary class", () => {
|
||||||
// Act
|
// Arrange/Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(
|
||||||
buttonMain,
|
buttonMain,
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
props: {
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Assert
|
|
||||||
const button = wrapper.find("button");
|
const button = wrapper.find("button");
|
||||||
|
|
||||||
// Expect
|
// Assert
|
||||||
expect(button.attributes("class")).toContain("btn-primary");
|
expect(button.attributes("class")).toContain("btn-primary");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should return aria-disabled state", async () => {
|
it("Should return aria-disabled state", () => {
|
||||||
// Act
|
// Arrange/Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(
|
||||||
buttonMain,
|
buttonMain,
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
props: {
|
||||||
isDisabled: true,
|
isDisabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Assert
|
|
||||||
const button = wrapper.find("button");
|
const button = wrapper.find("button");
|
||||||
|
|
||||||
// Expect
|
// Assert
|
||||||
expect(button.attributes()["aria-disabled"]).toEqual("true");
|
expect(button.attributes()["aria-disabled"]).toEqual("true");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should return loader color", async () => {
|
it("Should return loader color", async () => {
|
||||||
// Act
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(
|
||||||
buttonMain,
|
buttonMain,
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
props: {
|
||||||
loaderColor: "blue",
|
loaderColor: "blue",
|
||||||
loaderEnabled: true,
|
loaderEnabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Assert
|
// Act
|
||||||
|
|
||||||
const label = wrapper.find("label");
|
|
||||||
|
|
||||||
wrapper.vm.clicked();
|
wrapper.vm.clicked();
|
||||||
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
const loader = wrapper.find("loader-stub");
|
const loader = wrapper.find("loader-stub");
|
||||||
|
|
||||||
expect(loader.attributes("class")).toContain("blue");
|
expect(loader.attributes("class")).toContain("blue");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should return loader position", async () => {
|
it("Should return loader position", async () => {
|
||||||
// Act
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(
|
||||||
buttonMain,
|
buttonMain,
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
props: {
|
||||||
loaderPosition: "right",
|
loaderPosition: "right",
|
||||||
loaderEnabled: true,
|
loaderEnabled: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Assert
|
// Act
|
||||||
|
|
||||||
const label = wrapper.find("label");
|
|
||||||
|
|
||||||
wrapper.vm.clicked();
|
wrapper.vm.clicked();
|
||||||
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
|
// Assert
|
||||||
const loader = wrapper.find("loader-stub");
|
const loader = wrapper.find("loader-stub");
|
||||||
|
|
||||||
expect(loader.attributes("class")).toContain("right");
|
expect(loader.attributes("class")).toContain("right");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1 +1,31 @@
|
||||||
test.todo("some test to be written in the future");
|
import { shallowMount, mount } from "@vue/test-utils";
|
||||||
|
import loader from "./loader";
|
||||||
|
|
||||||
|
describe("loader.vue", () => {
|
||||||
|
test("if it rendered the HTML element with class", () => {
|
||||||
|
// Arrange/Act
|
||||||
|
const wrapper = shallowMount(loader, {
|
||||||
|
props: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.find("div").exists()).toBeTruthy();
|
||||||
|
expect(wrapper.find(".loader").exists()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("if it correctly passed props", () => {
|
||||||
|
// Arrange/Act
|
||||||
|
const wrapper = shallowMount(loader, {
|
||||||
|
props: {
|
||||||
|
loaderColor: "blue",
|
||||||
|
loaderPosition: "left",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.props()).toMatchObject({
|
||||||
|
loaderColor: "blue",
|
||||||
|
loaderPosition: "left",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue