diff --git a/package.json b/package.json index 67ac8ebb4cb48c24e30e49efda8c4ea164194577..3080b8bf5eff2ac495c77fd6065cde573e69e6a8 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,8 @@ "!dist/**", "!tests/**", "!babel.config.js", - "!vue.config.js" + "!vue.config.js", + "!public/static/js/**" ], "coverageReporters": [ "html", diff --git a/src/assets/images/ADCE_white.svg b/src/assets/images/ADCE_white.svg index 0d9917caf4558aad7d3b1fa15e09b0b1d12dd41b..af9548690a6b8dda648e854bb5b1d2db77d6f0ec 100644 --- a/src/assets/images/ADCE_white.svg +++ b/src/assets/images/ADCE_white.svg @@ -1 +1 @@ -<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 240"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M127.63,114.18,113.86,85.06h-47l3.7-8.16h39.41L84.63,23.72l-43,90.46H33L81.16,13.59c.9-2,2-3.09,3.81-3.09,1.57,0,2.69,1.12,3.69,3.09l48,100.59Z"/><path class="cls-1" d="M156.41,114.18V10.5H212.9c27.34,0,47.19,20.68,47.19,50.77s-19.85,52.91-47.19,52.91Zm56.49-9.56c21.93,0,37.89-18.39,37.89-42.92s-16-41.65-37.89-41.65H165.85v84.57Z"/><path class="cls-1" d="M82.05,230.26c-28.33,0-49-22.82-49-52.91,0-30.52,20.71-50.78,49-50.78H136.7v9.56H82.05c-22.72,0-39.26,17-39.26,41.64S59.33,220.7,82.05,220.7H136.7v9.56Z"/><path class="cls-1" d="M156.41,230.26V126.57H259.93v9.56h-92.3V220.7h92.46v9.56Zm27.07-48.35v-9h72v9Z"/></svg> \ No newline at end of file +<svg id="Layer_1" style="fill:#fff;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 240"><path class="cls-1" d="M127.63,114.18,113.86,85.06h-47l3.7-8.16h39.41L84.63,23.72l-43,90.46H33L81.16,13.59c.9-2,2-3.09,3.81-3.09,1.57,0,2.69,1.12,3.69,3.09l48,100.59Z"/><path class="cls-1" d="M156.41,114.18V10.5H212.9c27.34,0,47.19,20.68,47.19,50.77s-19.85,52.91-47.19,52.91Zm56.49-9.56c21.93,0,37.89-18.39,37.89-42.92s-16-41.65-37.89-41.65H165.85v84.57Z"/><path class="cls-1" d="M82.05,230.26c-28.33,0-49-22.82-49-52.91,0-30.52,20.71-50.78,49-50.78H136.7v9.56H82.05c-22.72,0-39.26,17-39.26,41.64S59.33,220.7,82.05,220.7H136.7v9.56Z"/><path class="cls-1" d="M156.41,230.26V126.57H259.93v9.56h-92.3V220.7h92.46v9.56Zm27.07-48.35v-9h72v9Z"/></svg> \ No newline at end of file diff --git a/src/assets/images/icons/Icon_process.svg b/src/assets/images/icons/Icon_process.svg index 9a2a0334f3d0034b8fc548e356da0e00af5597a8..25ea9cfe34e64131aa3a63ec5b82d4f6d5def60e 100644 --- a/src/assets/images/icons/Icon_process.svg +++ b/src/assets/images/icons/Icon_process.svg @@ -1,5 +1,3 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generator: Adobe Illustrator 24.1.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 378" style="enable-background:new 0 0 512 378;" xml:space="preserve"> <path d="M488,133h-88c-4.4,0-8,3.6-8,8v24h-53.6l-70-46.7c-2.7-1.8-6.2-1.8-8.9,0l-70,46.7h-51.3l5.5-22.1c1.1-4.3-1.5-8.6-5.8-9.7 diff --git a/src/assets/images/icons/Icon_software-development-tools.svg b/src/assets/images/icons/Icon_software-development-tools.svg index a97c15b985e43ae55c0fc9f9c57980d0dcabb187..c190c39cb3d7823c2ab309d33415e0bfd4f4b875 100644 --- a/src/assets/images/icons/Icon_software-development-tools.svg +++ b/src/assets/images/icons/Icon_software-development-tools.svg @@ -1,5 +1,3 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generator: Adobe Illustrator 24.1.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 582.3 510" style="enable-background:new 0 0 582.3 510;" xml:space="preserve"> <path d="M546.2,16H36.8C21.3,16,8.5,26.8,8.5,40v352c0,13.2,12.7,24,28.3,24h194.8L209,480h-30.7v16h226.4v-16h-30.7l-22.6-64h194.8 diff --git a/tests/unit/components/Breadcrumb.spec.js b/tests/unit/components/Breadcrumb.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..974d352f5daaddd0023207d5fc3902175e32f0a1 --- /dev/null +++ b/tests/unit/components/Breadcrumb.spec.js @@ -0,0 +1,58 @@ +import { shallowMount, createLocalVue } from "@vue/test-utils"; +import { BootstrapVue, IconsPlugin } from "bootstrap-vue"; +import Breadcrumb from "@/components/Breadcrumb.vue"; +import VueRouter from "vue-router"; +import Router from "@/router"; + +// vue-easy-lightbox doesn't play nice in tests, so we have to mock it +jest.mock("vue-easy-lightbox", () => { + return { + install: jest.fn() + }; +}); + +const localVue = createLocalVue(); +localVue.use(VueRouter); +localVue.use(BootstrapVue); +localVue.use(IconsPlugin); + +describe("Breadcrumb.vue", () => { + let wrapper; + beforeEach(() => { + wrapper = shallowMount(Breadcrumb, { localVue, router: Router }); + }); + afterEach(() => { + jest.clearAllMocks(); + }); + + it("should compute crumbs", async () => { + window.scrollTo = jest.fn(); + await Router.push("/services"); + expect(wrapper.vm.crumbs).toStrictEqual([ + { path: "", to: "/", text: "Home" }, + { + path: "/services", + to: "/services", + text: "Services", + active: true + } + ]); + + await Router.push("/products/abms-adce"); + expect(wrapper.vm.crumbs).toStrictEqual([ + { path: "", to: "/", text: "Home" }, + { path: "/products", to: "/products", text: "Products" }, + { + path: "/products/abms-adce", + to: "/products/abms-adce", + text: "The Party Bus", + active: true + } + ]); + + await Router.push("/mock-path"); + expect(wrapper.vm.crumbs).toStrictEqual([ + { path: "", to: "/", text: "Home", active: true } + ]); + }); +}); diff --git a/tests/unit/router/index.spec.js b/tests/unit/router/index.spec.js index 668ba393d29aea3675302f80affde94d2e348eeb..cd8bbeeae3a37698b55439154d83585d36d01459 100644 --- a/tests/unit/router/index.spec.js +++ b/tests/unit/router/index.spec.js @@ -34,23 +34,43 @@ describe("router", () => { expect(router.currentRoute.path).toBe("/"); }); - it("should route to /services", async () => { - router.push("/services"); - await wrapper.vm.$nextTick(); + it("should do routing", async () => { + await router.push("/services"); expect(router.currentRoute.name).toBe("Services"); expect(router.currentRoute.path).toBe("/services"); - }); - it("should route to /who-we-are", async () => { - router.push("/who-we-are"); - await wrapper.vm.$nextTick(); + await router.push({ path: "/who-we-are" }); expect(router.currentRoute.name).toBe("WhoWeAre"); expect(router.currentRoute.path).toBe("/who-we-are"); - }); - it("should route to /products", async () => { - router.push("/products"); - await wrapper.vm.$nextTick(); + + await router.push("/products"); expect(router.currentRoute.name).toBe("Products"); expect(router.currentRoute.path).toBe("/products"); + + await router.push("/contact-us"); + expect(router.currentRoute.name).toBe("ContactUs"); + expect(router.currentRoute.path).toBe("/contact-us"); + + await router.push("/products/abms-adce"); + expect(router.currentRoute.name).toBe("ADCE"); + expect(router.currentRoute.path).toBe("/products/abms-adce"); + }); + + it("should respect savedPosition", async () => { + const savedPosition = { x: 42, y: 24 }; + const result = await Router.options.scrollBehavior({}, {}, savedPosition); + expect(result).toStrictEqual(savedPosition); + }); + + it("should respect hash", async () => { + const to = { hash: "#test-hash" }; + const result = await Router.options.scrollBehavior(to); + expect(result).toStrictEqual({ selector: to.hash }); + }); + + it("should default scroll to 0,0", async () => { + const to = {}; + const result = await Router.options.scrollBehavior(to); + expect(result).toStrictEqual({ x: 0, y: 0 }); }); }); diff --git a/tests/unit/views/ADCE.spec.js b/tests/unit/views/ADCE.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..78ba62bd69d6495975b9c25dcc97af2828a54d7b --- /dev/null +++ b/tests/unit/views/ADCE.spec.js @@ -0,0 +1,36 @@ +import { shallowMount, RouterLinkStub } from "@vue/test-utils"; +import ADCE from "@/views/ADCE.vue"; + +// vue-easy-lightbox doesn't play nice in tests, so we have to mock it +jest.mock("vue-easy-lightbox", () => { + return { + install: jest.fn() + }; +}); + +describe("ADCE.vue", () => { + let wrapper; + beforeEach(() => { + wrapper = shallowMount(ADCE, { + stubs: { + RouterLink: RouterLinkStub + } + }); + }); + afterEach(() => { + jest.clearAllMocks(); + }); + + it("should show lightbox", () => { + expect(wrapper.vm.lightbox.visible).toBe(false); + expect(wrapper.vm.lightbox.index).toBe(0); + wrapper.vm.showImg(1); + expect(wrapper.vm.lightbox.visible).toBe(true); + expect(wrapper.vm.lightbox.index).toBe(1); + }); + it("should show lightbox", () => { + wrapper.vm.showImg(0); + wrapper.vm.handleHide(); + expect(wrapper.vm.lightbox.visible).toBe(false); + }); +}); diff --git a/tests/unit/views/ContactUs.spec.js b/tests/unit/views/ContactUs.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..01b0cf7c4e8c9e180fdd5f58b3066cb9db552536 --- /dev/null +++ b/tests/unit/views/ContactUs.spec.js @@ -0,0 +1,31 @@ +import { shallowMount, RouterLinkStub } from "@vue/test-utils"; +import { iframeResizer } from "iframe-resizer"; +import ContactUs from "@/views/ContactUs.vue"; + +describe("ContactUs.vue", () => { + let wrapper; + beforeEach(() => { + process.env.BASE_URL = "test"; + wrapper = shallowMount(ContactUs, { + stubs: { + RouterLink: RouterLinkStub + }, + directives: { + resize: { + bind: function(el, { value = {} }) { + el.addEventListener("load", () => iframeResizer(value, el)); + } + } + } + }); + }); + afterEach(() => { + jest.clearAllMocks(); + }); + + it("should respect BASE_URL", () => { + expect(wrapper.find("iframe").attributes("src")).toBe( + "test/static/p1-intake-form.html" + ); + }); +});