Merge pull request #887 from Safelite/feature/CSR-803-refactoring-2

CSR-938: fix vehicle-parts back button
This commit is contained in:
AdamCaouetteSafelite 2022-12-21 13:42:33 -05:00 committed by GitHub
commit cbd6dcfff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 40 deletions

View file

@ -2,14 +2,6 @@ import { shallowMount, mount } from "@vue/test-utils";
import buttonQuestion from "@/common-components/button-question/button-question";
import { getMountOptions } from "@/helpers/unit-test-helper.js";
jest.mock(
"@/store",
() => {
return {};
},
{ virtual: true }
);
describe("buttonQuestion.vue", () => {
it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => {
// Act

View file

@ -23,8 +23,6 @@ describe("dropdownQuestion.vue", () => {
mixins: [mockMixin],
});
wrapper.getCmsContent = jest.fn();
// Act
const select = wrapper.find("select");

View file

@ -35,7 +35,7 @@
cmsWidgetName="FunnelFooterWidget"
ref="funnelFooter"
:isForwardActionDisabled="isForwardActionDisabled"
@back-click="navigateBack"
@back-clicked="navigateBack"
@ForwardClicked="forwardButtonAction" />
</div>
</div>

View file

@ -4,89 +4,77 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js";
import { nextTick } from "vue";
describe("buttonMain.vue", () => {
it("Should return btn-primary class", async () => {
// Act
it("Should return btn-primary class", () => {
// Arrange/Act
const wrapper = shallowMount(
buttonMain,
setupMocks({
propsData: {
props: {
isPrimary: true,
},
})
);
// Assert
const button = wrapper.find("button");
// Expect
// Assert
expect(button.attributes("class")).toContain("btn-primary");
});
it("Should return aria-disabled state", async () => {
// Act
it("Should return aria-disabled state", () => {
// Arrange/Act
const wrapper = shallowMount(
buttonMain,
setupMocks({
propsData: {
props: {
isDisabled: true,
},
})
);
// Assert
const button = wrapper.find("button");
// Expect
// Assert
expect(button.attributes()["aria-disabled"]).toEqual("true");
});
it("Should return loader color", async () => {
// Act
// Arrange
const wrapper = shallowMount(
buttonMain,
setupMocks({
propsData: {
props: {
loaderColor: "blue",
loaderEnabled: true,
},
})
);
// Assert
const label = wrapper.find("label");
// 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 () => {
// Act
// Arrange
const wrapper = shallowMount(
buttonMain,
setupMocks({
propsData: {
props: {
loaderPosition: "right",
loaderEnabled: true,
},
})
);
// Assert
const label = wrapper.find("label");
// Act
wrapper.vm.clicked();
await nextTick();
// Assert
const loader = wrapper.find("loader-stub");
expect(loader.attributes("class")).toContain("right");
});
});

View file

@ -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",
});
});
});