Merge pull request #139 from Safelite/feature/SSR-235
SSR-235: Update ux-component text-link
This commit is contained in:
commit
c3573ff771
4 changed files with 51 additions and 10 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
/* eslint-env jest */
|
/* eslint-env jest */
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||||
|
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||||
|
import { queryStrings } from '@/constants/query-strings';
|
||||||
|
import { GaActions } from "@/constants/analytics";
|
||||||
import VehicleLookup from './vehicle-lookup.vue';
|
import VehicleLookup from './vehicle-lookup.vue';
|
||||||
|
|
||||||
const vinLookupMethodsMockData = {
|
const vinLookupMethodsMockData = {
|
||||||
|
|
@ -55,6 +58,12 @@ function setupMocks() {
|
||||||
mixins: [
|
mixins: [
|
||||||
{
|
{
|
||||||
computed: {
|
computed: {
|
||||||
|
GaActions() {
|
||||||
|
return GaActions;
|
||||||
|
},
|
||||||
|
queryStrings() {
|
||||||
|
return queryStrings;
|
||||||
|
},
|
||||||
navigationScenarios() {
|
navigationScenarios() {
|
||||||
return navigationScenarios;
|
return navigationScenarios;
|
||||||
},
|
},
|
||||||
|
|
@ -80,6 +89,7 @@ function setupMocks() {
|
||||||
}),
|
}),
|
||||||
getFooterInfoBoxHeight: jest.fn(() => 80),
|
getFooterInfoBoxHeight: jest.fn(() => 80),
|
||||||
getPageNameByQueryString: jest.fn(() => "vehicle-lookup"),
|
getPageNameByQueryString: jest.fn(() => "vehicle-lookup"),
|
||||||
|
pushEventToGA: jest.fn(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,23 @@
|
||||||
import { render } from '@testing-library/vue';
|
import { render } from '@testing-library/vue';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
|
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||||
|
import { queryStrings } from '@/constants/query-strings';
|
||||||
|
import { GaActions } from "@/constants/analytics";
|
||||||
import VinLocationInformationComponent from './vin-location-information.vue';
|
import VinLocationInformationComponent from './vin-location-information.vue';
|
||||||
|
|
||||||
const mockText = Object.freeze({
|
const mockText = Object.freeze({
|
||||||
HEADER: 'Mock Header',
|
HEADER: 'Mock Header',
|
||||||
BODY: 'Mock Body',
|
BODY: 'Mock Body',
|
||||||
});
|
});
|
||||||
|
const mockRoute = {
|
||||||
|
query: {
|
||||||
|
issPage: issPageValues.VIN_LOOKUP,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const mockRouter = {
|
||||||
|
navigate: jest.fn(),
|
||||||
|
};
|
||||||
|
|
||||||
const mountOptions = {
|
const mountOptions = {
|
||||||
global: {
|
global: {
|
||||||
|
|
@ -27,9 +38,22 @@ const mountOptions = {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}),
|
}),
|
||||||
|
pushEventToGA: jest.fn()
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
GaActions() {
|
||||||
|
return GaActions;
|
||||||
|
},
|
||||||
|
queryStrings() {
|
||||||
|
return queryStrings;
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
mocks: {
|
||||||
|
$route: mockRoute,
|
||||||
|
$router: mockRouter,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import { createTestingPinia } from '@pinia/testing';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import { errorMessages } from '@/constants/error-messages';
|
import { errorMessages } from '@/constants/error-messages';
|
||||||
import { issPageValues } from '@/router/router-constants/issPage-values';
|
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||||
|
import { queryStrings } from '@/constants/query-strings';
|
||||||
|
import { GaActions } from "@/constants/analytics";
|
||||||
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
|
||||||
import { routerParams } from '@/router/router-params';
|
import { routerParams } from '@/router/router-params';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
@ -134,11 +136,18 @@ const mountOptions = {
|
||||||
getFooterInfoBoxHeight: jest.fn(() => 80),
|
getFooterInfoBoxHeight: jest.fn(() => 80),
|
||||||
cssClassNameForCmsWidget: jest.fn(() => 'widget-name-mock-class'),
|
cssClassNameForCmsWidget: jest.fn(() => 'widget-name-mock-class'),
|
||||||
getPageNameByQueryString: jest.fn(() => ''),
|
getPageNameByQueryString: jest.fn(() => ''),
|
||||||
|
pushEventToGA: jest.fn(),
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
GaActions() {
|
||||||
|
return GaActions;
|
||||||
|
},
|
||||||
navigationScenarios() {
|
navigationScenarios() {
|
||||||
return navigationScenarios;
|
return navigationScenarios;
|
||||||
},
|
},
|
||||||
|
queryStrings() {
|
||||||
|
return queryStrings;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,6 @@
|
||||||
{{text}}
|
{{text}}
|
||||||
<slot name="after-text"></slot>
|
<slot name="after-text"></slot>
|
||||||
</a>
|
</a>
|
||||||
<a v-else-if="linkType === 'dashedUnderline'" @click="handleClick" class="dashed-underline" :href="href">
|
|
||||||
{{text}}
|
|
||||||
<slot name="after-text"></slot>
|
|
||||||
</a>
|
|
||||||
<a v-else-if="linkType === 'text'" @click="handleClick" :href="href">
|
<a v-else-if="linkType === 'text'" @click="handleClick" :href="href">
|
||||||
{{text}}
|
{{text}}
|
||||||
<slot name="after-text"></slot>
|
<slot name="after-text"></slot>
|
||||||
|
|
@ -33,6 +29,12 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClick(event) {
|
handleClick(event) {
|
||||||
|
this.pushEventToGA(
|
||||||
|
this.$route.query[this.queryStrings.ISS_PAGE],
|
||||||
|
this.GaActions.CLICKED,
|
||||||
|
this.text,
|
||||||
|
true
|
||||||
|
);
|
||||||
this.$emit("click-event");
|
this.$emit("click-event");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -41,10 +43,9 @@
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
a {
|
a {
|
||||||
display: inline-flex !important;
|
|
||||||
color: $blue;
|
color: $blue;
|
||||||
text-underline-offset: 0.5em;
|
text-underline-offset: 5px;
|
||||||
line-height: 26px;
|
line-height: 2;
|
||||||
padding: 0 0 4px 0;
|
padding: 0 0 4px 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
max-width: fit-content;
|
max-width: fit-content;
|
||||||
|
|
@ -75,9 +76,6 @@
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.dashed-underline {
|
|
||||||
text-decoration: underline dashed 1px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
Loading…
Reference in a new issue