Linting changes to ux-compontents
This commit is contained in:
parent
a1b21c9e19
commit
30ea8cb880
19 changed files with 325 additions and 258 deletions
20
jsconfig.json
Normal file
20
jsconfig.json
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"module": "esnext",
|
||||||
|
"baseUrl": "./",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"paths": {
|
||||||
|
"@/*": [
|
||||||
|
"src/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"scripthost"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -6,8 +6,7 @@ import alert from './alert';
|
||||||
describe('alert.vue', () => {
|
describe('alert.vue', () => {
|
||||||
it("Should add class 'alert-dismissible' if isDismissible is true", async () => {
|
it("Should add class 'alert-dismissible' if isDismissible is true", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(alert,
|
||||||
alert,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
isDismissible: true,
|
isDismissible: true,
|
||||||
|
|
@ -15,8 +14,7 @@ describe('alert.vue', () => {
|
||||||
manualCopy: 'testCopy',
|
manualCopy: 'testCopy',
|
||||||
cmsWidgetName: 'alert'
|
cmsWidgetName: 'alert'
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
const wrapperDiv = wrapper.find('div');
|
const wrapperDiv = wrapper.find('div');
|
||||||
|
|
||||||
|
|
@ -26,8 +24,7 @@ describe('alert.vue', () => {
|
||||||
|
|
||||||
it('Should add specified alert class', async () => {
|
it('Should add specified alert class', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(alert,
|
||||||
alert,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
alertClass: 'warning',
|
alertClass: 'warning',
|
||||||
|
|
@ -35,8 +32,7 @@ describe('alert.vue', () => {
|
||||||
manualCopy: 'testCopy',
|
manualCopy: 'testCopy',
|
||||||
cmsWidgetName: 'alert'
|
cmsWidgetName: 'alert'
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
const wrapperDiv = wrapper.find('div');
|
const wrapperDiv = wrapper.find('div');
|
||||||
|
|
||||||
|
|
@ -54,24 +50,21 @@ describe('alert.vue', () => {
|
||||||
|
|
||||||
it('Should container a <router-link> tag if the manualCopy contains a {routerLink: testName, testLink} placeholder', () => {
|
it('Should container a <router-link> tag if the manualCopy contains a {routerLink: testName, testLink} placeholder', () => {
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(alert,
|
||||||
alert,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
manualHeadline: 'testHeader',
|
manualHeadline: 'testHeader',
|
||||||
manualCopy: 'testCopy with a {routerLink: testName, testLink} inside of it',
|
manualCopy: 'testCopy with a {routerLink: testName, testLink} inside of it',
|
||||||
cmsWidgetName: 'alert'
|
cmsWidgetName: 'alert'
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.findComponent(RouterLinkStub).exists()).toBe(true);
|
expect(wrapper.findComponent(RouterLinkStub).exists()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should contain 'n+1' <p> tags if the body copy has 'n' <p> tags", () => {
|
it("Should contain 'n+1' <p> tags if the body copy has 'n' <p> tags", () => {
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(alert,
|
||||||
alert,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
manualHeadline: 'testHeader',
|
manualHeadline: 'testHeader',
|
||||||
|
|
@ -79,22 +72,19 @@ describe('alert.vue', () => {
|
||||||
'<p>testCopy with a {routerLink: testName, testLink} inside of it</p><p>and two paragraphs</p>',
|
'<p>testCopy with a {routerLink: testName, testLink} inside of it</p><p>and two paragraphs</p>',
|
||||||
cmsWidgetName: 'alert'
|
cmsWidgetName: 'alert'
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.findAll('p').length === 3).toBe(true);
|
expect(wrapper.findAll('p').length === 3).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should call scrollIntoView() when the clientBoundingRect is not entirely in the viewport (out of view top)', () => {
|
it('Should call scrollIntoView() when the clientBoundingRect is not entirely in the viewport (out of view top)', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
var viewPortHeight = 200;
|
const viewPortHeight = 200;
|
||||||
setUpViewPort(viewPortHeight);
|
setUpViewPort(viewPortHeight);
|
||||||
|
|
||||||
Element.prototype.getBoundingClientRect = jest.fn(() => {
|
Element.prototype.getBoundingClientRect = jest.fn(() => ({ top: -100, bottom: 200 }));
|
||||||
return { top: -100, bottom: 200 };
|
|
||||||
});
|
|
||||||
|
|
||||||
var mockScrollIntoView = jest.fn();
|
const mockScrollIntoView = jest.fn();
|
||||||
Element.prototype.scrollIntoView = mockScrollIntoView;
|
Element.prototype.scrollIntoView = mockScrollIntoView;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -109,14 +99,12 @@ describe('alert.vue', () => {
|
||||||
|
|
||||||
it('Should call scrollIntoView() when the clientBoundingRect is not entirely in the viewport (bottom is hidden behind footer)', () => {
|
it('Should call scrollIntoView() when the clientBoundingRect is not entirely in the viewport (bottom is hidden behind footer)', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
var viewPortHeight = 240;
|
const viewPortHeight = 240;
|
||||||
setUpViewPort(viewPortHeight);
|
setUpViewPort(viewPortHeight);
|
||||||
|
|
||||||
Element.prototype.getBoundingClientRect = jest.fn(() => {
|
Element.prototype.getBoundingClientRect = jest.fn(() => ({ top: 100, bottom: 200 }));
|
||||||
return { top: 100, bottom: 200 };
|
|
||||||
});
|
|
||||||
|
|
||||||
var mockScrollIntoView = jest.fn();
|
const mockScrollIntoView = jest.fn();
|
||||||
Element.prototype.scrollIntoView = mockScrollIntoView;
|
Element.prototype.scrollIntoView = mockScrollIntoView;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -131,19 +119,16 @@ describe('alert.vue', () => {
|
||||||
|
|
||||||
it("Should not call scrollIntoView() when the clientBoundingRect is not entirely in the viewport but 'shouldScrollToOnMount' is false", () => {
|
it("Should not call scrollIntoView() when the clientBoundingRect is not entirely in the viewport but 'shouldScrollToOnMount' is false", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
var viewPortHeight = 200;
|
const viewPortHeight = 200;
|
||||||
setUpViewPort(viewPortHeight);
|
setUpViewPort(viewPortHeight);
|
||||||
|
|
||||||
Element.prototype.getBoundingClientRect = jest.fn(() => {
|
Element.prototype.getBoundingClientRect = jest.fn(() => ({ top: -100, bottom: 200 }));
|
||||||
return { top: -100, bottom: 200 };
|
|
||||||
});
|
|
||||||
|
|
||||||
var mockScrollIntoView = jest.fn();
|
const mockScrollIntoView = jest.fn();
|
||||||
Element.prototype.scrollIntoView = mockScrollIntoView;
|
Element.prototype.scrollIntoView = mockScrollIntoView;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(alert,
|
||||||
alert,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
shouldScrollToOnMount: false,
|
shouldScrollToOnMount: false,
|
||||||
|
|
@ -151,8 +136,7 @@ describe('alert.vue', () => {
|
||||||
manualCopy: 'testCopy',
|
manualCopy: 'testCopy',
|
||||||
cmsWidgetName: 'alert'
|
cmsWidgetName: 'alert'
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// This is an implementation detail - we just need to test that the final step of snapping
|
// This is an implementation detail - we just need to test that the final step of snapping
|
||||||
|
|
@ -163,14 +147,12 @@ describe('alert.vue', () => {
|
||||||
|
|
||||||
it('Should not call scrollIntoView() when the clientBoundingRect is entirely in the viewport', () => {
|
it('Should not call scrollIntoView() when the clientBoundingRect is entirely in the viewport', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
var viewPortHeight = 500;
|
const viewPortHeight = 500;
|
||||||
setUpViewPort(viewPortHeight);
|
setUpViewPort(viewPortHeight);
|
||||||
|
|
||||||
Element.prototype.getBoundingClientRect = jest.fn(() => {
|
Element.prototype.getBoundingClientRect = jest.fn(() => ({ top: 100, bottom: 200 }));
|
||||||
return { top: 100, bottom: 200 };
|
|
||||||
});
|
|
||||||
|
|
||||||
var mockScrollIntoView = jest.fn();
|
const mockScrollIntoView = jest.fn();
|
||||||
Element.prototype.scrollIntoView = mockScrollIntoView;
|
Element.prototype.scrollIntoView = mockScrollIntoView;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -187,18 +169,20 @@ describe('alert.vue', () => {
|
||||||
const mockMixin = {
|
const mockMixin = {
|
||||||
methods: {
|
methods: {
|
||||||
getCmsContent: jest.fn(),
|
getCmsContent: jest.fn(),
|
||||||
getFooterInfoBoxHeight: jest.fn(() => 50),
|
getFooterInfoBoxHeight: jest.fn(() => 50)
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
dynamicStrings: jest.fn(() => {
|
dynamicStrings: jest.fn(() => ({ ROUTER_LINK: 'routerLink:' })),
|
||||||
return { ROUTER_LINK: 'routerLink:' };
|
|
||||||
}),
|
|
||||||
cssClassNameForCmsWidget() {
|
cssClassNameForCmsWidget() {
|
||||||
return 'widget-name-';
|
return 'widget-name-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param height
|
||||||
|
*/
|
||||||
function setUpViewPort(height) {
|
function setUpViewPort(height) {
|
||||||
Object.defineProperty(global.window, 'innerHeight', {
|
Object.defineProperty(global.window, 'innerHeight', {
|
||||||
writable: true,
|
writable: true,
|
||||||
|
|
@ -213,6 +197,10 @@ function setUpViewPort(height) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param mountOptionsMockData
|
||||||
|
*/
|
||||||
function setupMocks(mountOptionsMockData = {}) {
|
function setupMocks(mountOptionsMockData = {}) {
|
||||||
const defaultMountOptions = {
|
const defaultMountOptions = {
|
||||||
propsData: {
|
propsData: {
|
||||||
|
|
@ -222,9 +210,7 @@ function setupMocks(mountOptionsMockData = {}) {
|
||||||
},
|
},
|
||||||
mixins: [mockMixin]
|
mixins: [mockMixin]
|
||||||
};
|
};
|
||||||
const baseMountOptions = getMountOptions(
|
const baseMountOptions = getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
|
||||||
Object.assign(defaultMountOptions, mountOptionsMockData)
|
|
||||||
);
|
|
||||||
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
||||||
return allMountOptions;
|
return allMountOptions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,32 +4,47 @@
|
||||||
role="alert"
|
role="alert"
|
||||||
:class="[
|
:class="[
|
||||||
isDismissible ? 'alert-dismissible' : '',
|
isDismissible ? 'alert-dismissible' : '',
|
||||||
this.alertClass,
|
alertClass,
|
||||||
this.cssClassNameForCmsWidget,
|
cssClassNameForCmsWidget,
|
||||||
]">
|
]">
|
||||||
<p class="m-0 fw-bold alert-heading">{{ alertHeadline }}</p>
|
<p class="m-0 fw-bold alert-heading">
|
||||||
<template v-for="paragraph in splitAlertCopyForParagraphTag" :key="paragraph">
|
{{ alertHeadline }}
|
||||||
|
</p>
|
||||||
|
<template
|
||||||
|
v-for="paragraph in splitAlertCopyForParagraphTag"
|
||||||
|
:key="paragraph">
|
||||||
<p
|
<p
|
||||||
class="m-0 text-body small"
|
|
||||||
v-if="!doesCopyContainRouterLink(paragraph)"
|
v-if="!doesCopyContainRouterLink(paragraph)"
|
||||||
|
class="m-0 text-body small"
|
||||||
v-html="paragraph"></p>
|
v-html="paragraph"></p>
|
||||||
<p class="m-0 text-body small" v-else>
|
<p
|
||||||
<template v-for="copy in splitCopyOnCMSPlaceHolder(paragraph)" :key="copy">
|
v-else
|
||||||
<span v-if="!doesCopyContainRouterLink(copy)" v-html="copy"></span>
|
class="m-0 text-body small">
|
||||||
|
<template
|
||||||
|
v-for="copy in splitCopyOnCMSPlaceHolder(paragraph)"
|
||||||
|
:key="copy">
|
||||||
|
<span
|
||||||
|
v-if="!doesCopyContainRouterLink(copy)"
|
||||||
|
v-html="copy"></span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
query: { [pageQueryString]: `${getRouterLinkRouteFromCopy(copy)}` },
|
query: { [pageQueryString]: `${getRouterLinkRouteFromCopy(copy)}` },
|
||||||
name: 'root',
|
name: 'root',
|
||||||
}"
|
}">{{ getRouterLinkDisplayTextFromCopy(copy) }}</router-link>
|
||||||
>{{ getRouterLinkDisplayTextFromCopy(copy) }}</router-link
|
|
||||||
>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
<button type="button" class="btn-close p-2" data-bs-dismiss="alert" aria-label="Close">
|
<button
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.7 23.7" xml:space="preserve">
|
type="button"
|
||||||
|
class="btn-close p-2"
|
||||||
|
data-bs-dismiss="alert"
|
||||||
|
aria-label="Close">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 23.7 23.7"
|
||||||
|
xml:space="preserve">
|
||||||
<path
|
<path
|
||||||
d="m23.24 2.7-9.15 9.15L23.24 21a1.581 1.581 0 0 1-1.12 2.7c-.42 0-.82-.16-1.12-.46l-9.15-9.15-9.15 9.15c-.3.3-.7.46-1.12.46A1.581 1.581 0 0 1 .46 21l8.47-8.47.68-.68L.46 2.7c-.62-.62-.62-1.62 0-2.24.62-.62 1.62-.62 2.24 0l8.47 8.47.68.68L21 .46a1.57 1.57 0 0 1 2.23 0c.63.62.63 1.62.01 2.24z" />
|
d="m23.24 2.7-9.15 9.15L23.24 21a1.581 1.581 0 0 1-1.12 2.7c-.42 0-.82-.16-1.12-.46l-9.15-9.15-9.15 9.15c-.3.3-.7.46-1.12.46A1.581 1.581 0 0 1 .46 21l8.47-8.47.68-.68L.46 2.7c-.62-.62-.62-1.62 0-2.24.62-.62 1.62-.62 2.24 0l8.47 8.47.68.68L21 .46a1.57 1.57 0 0 1 2.23 0c.63.62.63 1.62.01 2.24z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
@ -93,14 +108,17 @@ export default {
|
||||||
return splitCMSCopyOnParagraphTag(this.alertCopy);
|
return splitCMSCopyOnParagraphTag(this.alertCopy);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.ensureAlertIsInViewPort();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doesCopyContainRouterLink,
|
doesCopyContainRouterLink,
|
||||||
splitCopyOnCMSPlaceHolder,
|
splitCopyOnCMSPlaceHolder,
|
||||||
getRouterLinkRouteFromCopy,
|
getRouterLinkRouteFromCopy,
|
||||||
getRouterLinkDisplayTextFromCopy,
|
getRouterLinkDisplayTextFromCopy,
|
||||||
ensureAlertIsInViewPort() {
|
ensureAlertIsInViewPort() {
|
||||||
if (this.shouldScrollToOnMount && this.$el.style.display != 'none') {
|
if (this.shouldScrollToOnMount && this.$el.style.display !== 'none') {
|
||||||
var footerHeight = this.getFooterInfoBoxHeight();
|
const footerHeight = this.getFooterInfoBoxHeight();
|
||||||
if (!this.isAlertInViewport(footerHeight)) {
|
if (!this.isAlertInViewport(footerHeight)) {
|
||||||
this.$el.scrollIntoView(true); // 'true' attempts to scroll element to top of viewport
|
this.$el.scrollIntoView(true); // 'true' attempts to scroll element to top of viewport
|
||||||
}
|
}
|
||||||
|
|
@ -109,21 +127,18 @@ export default {
|
||||||
isAlertInViewport(footerHeight) {
|
isAlertInViewport(footerHeight) {
|
||||||
const rect = this.$el.getBoundingClientRect();
|
const rect = this.$el.getBoundingClientRect();
|
||||||
return (
|
return (
|
||||||
rect.top >= 0 &&
|
rect.top >= 0
|
||||||
// remove footerHeight from window height to avoid items being hidden behind footer
|
// remove footerHeight from window height to avoid items being hidden behind footer
|
||||||
rect.bottom <=
|
&& rect.bottom
|
||||||
(window.innerHeight - footerHeight ||
|
<= (window.innerHeight - footerHeight
|
||||||
document.documentElement.clientHeight - footerHeight)
|
|| document.documentElement.clientHeight - footerHeight)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.ensureAlertIsInViewPort();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.alert {
|
.alert {
|
||||||
button {
|
button {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import buttonMain from './button-main';
|
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
|
import buttonMain from './button-main';
|
||||||
|
|
||||||
describe('buttonMain.vue', () => {
|
describe('buttonMain.vue', () => {
|
||||||
it('Should return btn-primary class', async () => {
|
it('Should return btn-primary class', async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(buttonMain,
|
||||||
buttonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
isPrimary: true
|
isPrimary: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
const button = wrapper.find('button');
|
const button = wrapper.find('button');
|
||||||
|
|
@ -24,14 +22,12 @@ describe('buttonMain.vue', () => {
|
||||||
|
|
||||||
it('Should return aria-disabled state', async () => {
|
it('Should return aria-disabled state', async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(buttonMain,
|
||||||
buttonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
isDisabled: true
|
isDisabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
const button = wrapper.find('button');
|
const button = wrapper.find('button');
|
||||||
|
|
@ -42,15 +38,13 @@ describe('buttonMain.vue', () => {
|
||||||
|
|
||||||
it('Should return loader color', async () => {
|
it('Should return loader color', async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(buttonMain,
|
||||||
buttonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderColor: 'blue',
|
loaderColor: 'blue',
|
||||||
loaderEnabled: true
|
loaderEnabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
||||||
|
|
@ -67,15 +61,13 @@ describe('buttonMain.vue', () => {
|
||||||
|
|
||||||
it('Should return loader position', async () => {
|
it('Should return loader position', async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(buttonMain,
|
||||||
buttonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: 'right',
|
loaderPosition: 'right',
|
||||||
loaderEnabled: true
|
loaderEnabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
||||||
|
|
@ -91,11 +83,13 @@ describe('buttonMain.vue', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param mountOptionsMockData
|
||||||
|
*/
|
||||||
function setupMocks(mountOptionsMockData = {}) {
|
function setupMocks(mountOptionsMockData = {}) {
|
||||||
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
|
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
|
||||||
const baseMountOptions = getMountOptions(
|
const baseMountOptions = getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
|
||||||
Object.assign(defaultMountOptions, mountOptionsMockData)
|
|
||||||
);
|
|
||||||
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
||||||
|
|
||||||
return allMountOptions;
|
return allMountOptions;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@
|
||||||
isLoaderDisplayed ? 'has-loader' : '',
|
isLoaderDisplayed ? 'has-loader' : '',
|
||||||
]"
|
]"
|
||||||
@click="clicked">
|
@click="clicked">
|
||||||
<span class="m-0">{{ this.buttonText }}</span>
|
<span class="m-0">{{ buttonText }}</span>
|
||||||
<loader
|
<loader
|
||||||
class="ms-2"
|
|
||||||
v-if="isLoaderDisplayed && !suppressLoader"
|
v-if="isLoaderDisplayed && !suppressLoader"
|
||||||
v-bind:class="[this.loaderColor, this.loaderPosition]" />
|
class="ms-2"
|
||||||
|
:class="[loaderColor, loaderPosition]" />
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -20,7 +20,10 @@
|
||||||
import loader from '@/ux-components/loader/loader';
|
import loader from '@/ux-components/loader/loader';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'buttonMain',
|
name: 'button-main',
|
||||||
|
components: {
|
||||||
|
loader
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
isPrimary: Boolean,
|
isPrimary: Boolean,
|
||||||
buttonText: String,
|
buttonText: String,
|
||||||
|
|
@ -30,6 +33,7 @@ export default {
|
||||||
isFloat: Boolean,
|
isFloat: Boolean,
|
||||||
suppressLoader: Boolean
|
suppressLoader: Boolean
|
||||||
},
|
},
|
||||||
|
emits: ['click-event'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isLoaderDisplayed: false
|
isLoaderDisplayed: false
|
||||||
|
|
@ -48,14 +52,11 @@ export default {
|
||||||
resetButtonStyle() {
|
resetButtonStyle() {
|
||||||
this.isLoaderDisplayed = false;
|
this.isLoaderDisplayed = false;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
components: {
|
|
||||||
loader
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.btn {
|
.btn {
|
||||||
&.btn-primary {
|
&.btn-primary {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -90,7 +91,7 @@ export default {
|
||||||
&.has-loader {
|
&.has-loader {
|
||||||
color: $white;
|
color: $white;
|
||||||
background: $blue-700;
|
background: $blue-700;
|
||||||
|
|
||||||
}
|
}
|
||||||
&.delay {
|
&.delay {
|
||||||
// fixes flicker while transitioning between states
|
// fixes flicker while transitioning between states
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import checkbox from './checkbox';
|
import checkbox from './checkbox';
|
||||||
import { nextTick } from 'vue';
|
|
||||||
|
|
||||||
describe('checkbox.vue', () => {
|
describe('checkbox.vue', () => {
|
||||||
it('Should return checkbox name', async () => {
|
it('Should return checkbox name', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,29 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- Checkbox groups MUST be wrapped in a <fieldset> and <legend> tag -->
|
<!-- Checkbox groups MUST be wrapped in a <fieldset> and <legend> tag -->
|
||||||
<div class="form-check ui-checkbox" :class="[hasError ? 'has-error' : '']">
|
<div
|
||||||
|
class="form-check ui-checkbox"
|
||||||
|
:class="[hasError ? 'has-error' : '']">
|
||||||
<input
|
<input
|
||||||
|
:id="buttonID"
|
||||||
|
:ref="checkboxName"
|
||||||
class="form-check-input"
|
class="form-check-input"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
aria-checked="false"
|
aria-checked="false"
|
||||||
:name="checkboxName"
|
:name="checkboxName"
|
||||||
:id="buttonID"
|
|
||||||
:tabindex="tabIndex"
|
:tabindex="tabIndex"
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:checked="isChecked"
|
:checked="isChecked"
|
||||||
@change="handleCheckChange"
|
@change="handleCheckChange" />
|
||||||
:ref="checkboxName" />
|
<label
|
||||||
<label class="d-flex align-items-start" :for="buttonID">
|
class="d-flex align-items-start"
|
||||||
<p v-if="checkboxLabel" class="m-0" v-html="checkboxLabel"></p>
|
:for="buttonID">
|
||||||
<span v-if="screenReaderOnlyText" class="sr-only">{{ screenReaderOnlyText }}</span>
|
<p
|
||||||
|
v-if="checkboxLabel"
|
||||||
|
class="m-0"
|
||||||
|
v-html="checkboxLabel"></p>
|
||||||
|
<span
|
||||||
|
v-if="screenReaderOnlyText"
|
||||||
|
class="sr-only">{{ screenReaderOnlyText }}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -35,6 +44,7 @@ export default {
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
emits: ['update:modelValue'],
|
||||||
methods: {
|
methods: {
|
||||||
handleCheckChange() {
|
handleCheckChange() {
|
||||||
this.$emit('update:modelValue', this.$refs[this.checkboxName].checked);
|
this.$emit('update:modelValue', this.$refs[this.checkboxName].checked);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import listButtonHorizontal from './list-button-horizontal';
|
|
||||||
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
||||||
|
import listButtonHorizontal from './list-button-horizontal';
|
||||||
|
|
||||||
describe('list-button-horizontal.vue', () => {
|
describe('list-button-horizontal.vue', () => {
|
||||||
describe('styling/UI', () => {
|
describe('styling/UI', () => {
|
||||||
|
|
@ -123,6 +123,11 @@ describe('list-button-horizontal.vue', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param root0
|
||||||
|
* @param root0.mockData
|
||||||
|
*/
|
||||||
function setupMocks({ mockData }) {
|
function setupMocks({ mockData }) {
|
||||||
const wrapper = mount(listButtonHorizontal, {
|
const wrapper = mount(listButtonHorizontal, {
|
||||||
...mockData,
|
...mockData,
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,27 @@
|
||||||
<template>
|
<template>
|
||||||
<baseInputButton
|
<baseInputButton
|
||||||
v-bind="$props"
|
v-bind="$props"
|
||||||
|
v-model="selectedValue"
|
||||||
:buttonWrapperClasses="[
|
:buttonWrapperClasses="[
|
||||||
'list-group list-button-horizontal d-flex flex-column w-100 base-input-button',
|
'list-group list-button-horizontal d-flex flex-column w-100 base-input-button',
|
||||||
{ strong: isStrongStyling },
|
{ strong: isStrongStyling },
|
||||||
]"
|
]">
|
||||||
v-model="selectedValue">
|
|
||||||
<div
|
<div
|
||||||
class="button-content list-button-horizontal-content d-flex flex-column justify-content-center p-3">
|
class="button-content list-button-horizontal-content d-flex flex-column justify-content-center p-3">
|
||||||
<span class="m-0" :class="textPosition">
|
<span
|
||||||
|
class="m-0"
|
||||||
|
:class="textPosition">
|
||||||
{{ buttonLabel }}
|
{{ buttonLabel }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="buttonLabelSubCopy" class="m-0 small" :class="textPosition">
|
<span
|
||||||
|
v-if="buttonLabelSubCopy"
|
||||||
|
class="m-0 small"
|
||||||
|
:class="textPosition">
|
||||||
{{ buttonLabelSubCopy }}
|
{{ buttonLabelSubCopy }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="screenReaderOnlyText" class="sr-only">
|
<span
|
||||||
|
v-if="screenReaderOnlyText"
|
||||||
|
class="sr-only">
|
||||||
{{ screenReaderOnlyText }}
|
{{ screenReaderOnlyText }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -26,20 +33,20 @@ import baseInputButton from '@/digital-components/base-input-button/base-input-b
|
||||||
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'listButtonHorizontal',
|
name: 'list-button-horizontal',
|
||||||
|
components: {
|
||||||
|
baseInputButton
|
||||||
|
},
|
||||||
mixins: [inputButtonWrapperMixin],
|
mixins: [inputButtonWrapperMixin],
|
||||||
computed: {
|
computed: {
|
||||||
isStrongStyling() {
|
isStrongStyling() {
|
||||||
return this.additionalButtonStyling === 'listButtonHorizontalStrong';
|
return this.additionalButtonStyling === 'listButtonHorizontalStrong';
|
||||||
}
|
}
|
||||||
},
|
|
||||||
components: {
|
|
||||||
baseInputButton
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.list-button-horizontal {
|
.list-button-horizontal {
|
||||||
input[type="radio"],
|
input[type="radio"],
|
||||||
input[type="checkbox"] {
|
input[type="checkbox"] {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import listButton from './list-button';
|
|
||||||
import { GaActions } from '@/constants/analytics';
|
import { GaActions } from '@/constants/analytics';
|
||||||
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
||||||
|
import listButton from './list-button';
|
||||||
|
|
||||||
describe('list-button.vue', () => {
|
describe('list-button.vue', () => {
|
||||||
describe('loader', () => {
|
describe('loader', () => {
|
||||||
|
|
@ -12,7 +12,7 @@ describe('list-button.vue', () => {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
$route: { query: { issPage: 'page-name' } },
|
$route: { query: { issPage: 'page-name' } },
|
||||||
GaActions: GaActions,
|
GaActions,
|
||||||
pushEventToGA: jest.fn()
|
pushEventToGA: jest.fn()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -38,7 +38,7 @@ describe('list-button.vue', () => {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
$route: { query: { issPage: 'page-name' } },
|
$route: { query: { issPage: 'page-name' } },
|
||||||
GaActions: GaActions,
|
GaActions,
|
||||||
pushEventToGA: jest.fn()
|
pushEventToGA: jest.fn()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -65,7 +65,7 @@ describe('list-button.vue', () => {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
$route: { query: { issPage: 'page-name' } },
|
$route: { query: { issPage: 'page-name' } },
|
||||||
GaActions: GaActions,
|
GaActions,
|
||||||
pushEventToGA: jest.fn()
|
pushEventToGA: jest.fn()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -294,6 +294,11 @@ describe('list-button.vue', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param root0
|
||||||
|
* @param root0.mockData
|
||||||
|
*/
|
||||||
function setupMocks({ mockData }) {
|
function setupMocks({ mockData }) {
|
||||||
const wrapper = mount(listButton, {
|
const wrapper = mount(listButton, {
|
||||||
...mockData,
|
...mockData,
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,30 @@
|
||||||
<template>
|
<template>
|
||||||
<baseInputButton
|
<baseInputButton
|
||||||
v-bind="$props"
|
v-bind="$props"
|
||||||
buttonWrapperClasses="list-group base-input-button list-button rounded-3 d-flex flex-column w-100 mb-2"
|
v-model="selectedValue"
|
||||||
v-model="selectedValue">
|
buttonWrapperClasses="list-group base-input-button list-button rounded-3 d-flex flex-column w-100 mb-2">
|
||||||
<div
|
<div
|
||||||
:aria-label="buttonLabel"
|
:aria-label="buttonLabel"
|
||||||
class="button-content list-button-content d-flex flex-column justify-content-center py-3 px-4">
|
class="button-content list-button-content d-flex flex-column justify-content-center py-3 px-4">
|
||||||
<span class="m-0" :class="textPosition">
|
<span
|
||||||
|
class="m-0"
|
||||||
|
:class="textPosition">
|
||||||
{{ buttonLabel }}
|
{{ buttonLabel }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="buttonLabelSubCopy" class="m-0 small" :class="textPosition">
|
<span
|
||||||
|
v-if="buttonLabelSubCopy"
|
||||||
|
class="m-0 small"
|
||||||
|
:class="textPosition">
|
||||||
{{ buttonLabelSubCopy }}
|
{{ buttonLabelSubCopy }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="screenReaderOnlyText" class="sr-only">
|
<span
|
||||||
|
v-if="screenReaderOnlyText"
|
||||||
|
class="sr-only">
|
||||||
{{ screenReaderOnlyText }}
|
{{ screenReaderOnlyText }}
|
||||||
</span>
|
</span>
|
||||||
<loader
|
<loader
|
||||||
v-if="isLoaderDisplayed && selectingInitiatesLoad"
|
v-if="isLoaderDisplayed && selectingInitiatesLoad"
|
||||||
:class="[this.loaderColor, this.loaderPosition]" />
|
:class="[loaderColor, loaderPosition]" />
|
||||||
</div>
|
</div>
|
||||||
</baseInputButton>
|
</baseInputButton>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -28,7 +35,11 @@ import baseInputButton from '@/digital-components/base-input-button/base-input-b
|
||||||
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'listButton',
|
name: 'list-button',
|
||||||
|
components: {
|
||||||
|
loader,
|
||||||
|
baseInputButton
|
||||||
|
},
|
||||||
mixins: [inputButtonWrapperMixin],
|
mixins: [inputButtonWrapperMixin],
|
||||||
props: {
|
props: {
|
||||||
loaderColor: String,
|
loaderColor: String,
|
||||||
|
|
@ -51,10 +62,6 @@ export default {
|
||||||
this.displayLoader();
|
this.displayLoader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
components: {
|
|
||||||
loader,
|
|
||||||
baseInputButton
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import listCard from './list-card';
|
import listCard from './list-card';
|
||||||
import { nextTick } from 'vue';
|
|
||||||
|
|
||||||
describe('list-card.vue', () => {
|
describe('list-card.vue', () => {
|
||||||
it('Should return input type checkbox if isMultiSelect is true', () => {
|
it('Should return input type checkbox if isMultiSelect is true', () => {
|
||||||
|
|
@ -121,7 +120,7 @@ describe('list-card.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
const label = wrapper.find('.list-card-content');
|
const label = wrapper.find('.list-card-content');
|
||||||
expect(label.exists()).toBe(true);
|
expect(label.exists()).toBe(true);
|
||||||
const labelClasses = wrapper.vm.labelClasses;
|
const { labelClasses } = wrapper.vm;
|
||||||
expect(labelClasses).toContain('flex-row');
|
expect(labelClasses).toContain('flex-row');
|
||||||
expect(label.classes()).toContain('flex-row');
|
expect(label.classes()).toContain('flex-row');
|
||||||
});
|
});
|
||||||
|
|
@ -146,7 +145,7 @@ describe('list-card.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
const label = wrapper.find('.list-card-content');
|
const label = wrapper.find('.list-card-content');
|
||||||
expect(label.exists()).toBe(true);
|
expect(label.exists()).toBe(true);
|
||||||
const labelClasses = wrapper.vm.labelClasses;
|
const { labelClasses } = wrapper.vm;
|
||||||
expect(labelClasses).toContain('flex-row');
|
expect(labelClasses).toContain('flex-row');
|
||||||
expect(label.classes()).toContain('flex-row');
|
expect(label.classes()).toContain('flex-row');
|
||||||
expect(labelClasses).toContain('checkboxTop');
|
expect(labelClasses).toContain('checkboxTop');
|
||||||
|
|
@ -172,7 +171,7 @@ describe('list-card.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
const label = wrapper.find('.list-card-content');
|
const label = wrapper.find('.list-card-content');
|
||||||
expect(label.exists()).toBe(true);
|
expect(label.exists()).toBe(true);
|
||||||
const labelClasses = wrapper.vm.labelClasses;
|
const { labelClasses } = wrapper.vm;
|
||||||
expect(labelClasses).toContain('flex-column');
|
expect(labelClasses).toContain('flex-column');
|
||||||
expect(label.classes()).toContain('flex-column');
|
expect(label.classes()).toContain('flex-column');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<baseInputButton
|
<baseInputButton
|
||||||
v-bind="$props"
|
v-bind="$props"
|
||||||
|
v-model="selectedValue"
|
||||||
:buttonWrapperClasses="[
|
:buttonWrapperClasses="[
|
||||||
'list-card w-100 rounded-3 d-flex align-items-center h-100 base-input-button',
|
'list-card w-100 rounded-3 d-flex align-items-center h-100 base-input-button',
|
||||||
{ horizontal: isWide },
|
{ horizontal: isWide },
|
||||||
]"
|
]">
|
||||||
v-model="selectedValue">
|
|
||||||
<div
|
<div
|
||||||
class="d-flex w-100 align-items-center px-2 h-100 list-card-content button-content rounded-3"
|
class="d-flex w-100 align-items-center px-2 h-100 list-card-content button-content rounded-3"
|
||||||
:class="labelClasses">
|
:class="labelClasses">
|
||||||
|
|
@ -14,15 +14,26 @@
|
||||||
:class="!isWide ? 'order-1' : 'ms-auto order-3'"
|
:class="!isWide ? 'order-1' : 'ms-auto order-3'"
|
||||||
:src="buttonImage"
|
:src="buttonImage"
|
||||||
:alt="altText" />
|
:alt="altText" />
|
||||||
<p v-if="!isWide" class="small order-3" :class="isMultiSelect ? 'm-0' : 'mt-2 mb-0'">
|
<p
|
||||||
|
v-if="!isWide"
|
||||||
|
class="small order-3"
|
||||||
|
:class="isMultiSelect ? 'm-0' : 'mt-2 mb-0'">
|
||||||
{{ buttonLabel }}
|
{{ buttonLabel }}
|
||||||
</p>
|
</p>
|
||||||
<p v-if="buttonLabelSubCopy && !isWide" class="fs-7 m-0 order-4 sub-copy">
|
<p
|
||||||
|
v-if="buttonLabelSubCopy && !isWide"
|
||||||
|
class="fs-7 m-0 order-4 sub-copy">
|
||||||
{{ buttonLabelSubCopy }}
|
{{ buttonLabelSubCopy }}
|
||||||
</p>
|
</p>
|
||||||
<div v-if="isWide" class="order-2">
|
<div
|
||||||
<p class="m-0 small">{{ buttonLabel }}</p>
|
v-if="isWide"
|
||||||
<p v-if="buttonLabelSubCopy" class="m-0 fs-7 sub-copy">
|
class="order-2">
|
||||||
|
<p class="m-0 small">
|
||||||
|
{{ buttonLabel }}
|
||||||
|
</p>
|
||||||
|
<p
|
||||||
|
v-if="buttonLabelSubCopy"
|
||||||
|
class="m-0 fs-7 sub-copy">
|
||||||
{{ buttonLabelSubCopy }}
|
{{ buttonLabelSubCopy }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -35,11 +46,11 @@ import baseInputButton from '@/digital-components/base-input-button/base-input-b
|
||||||
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
import inputButtonWrapperMixin from '@/mixins/input-button-wrapper-mixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'listCard',
|
name: 'list-card',
|
||||||
mixins: [inputButtonWrapperMixin],
|
|
||||||
components: {
|
components: {
|
||||||
baseInputButton
|
baseInputButton
|
||||||
},
|
},
|
||||||
|
mixins: [inputButtonWrapperMixin],
|
||||||
computed: {
|
computed: {
|
||||||
labelClasses() {
|
labelClasses() {
|
||||||
if (this.isWide) {
|
if (this.isWide) {
|
||||||
|
|
@ -48,15 +59,14 @@ export default {
|
||||||
classes += ' checkboxTop';
|
classes += ' checkboxTop';
|
||||||
}
|
}
|
||||||
return classes;
|
return classes;
|
||||||
} else {
|
|
||||||
return 'flex-column pt-4 pb-3';
|
|
||||||
}
|
}
|
||||||
|
return 'flex-column pt-4 pb-3';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
@mixin list-card-focus($box-shadow-color) {
|
@mixin list-card-focus($box-shadow-color) {
|
||||||
&:focus-visible + .list-card-content {
|
&:focus-visible + .list-card-content {
|
||||||
box-shadow: 0 0 0 2.5px $box-shadow-color;
|
box-shadow: 0 0 0 2.5px $box-shadow-color;
|
||||||
|
|
@ -81,7 +91,8 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
// svg's should be constructed on the same canvas size/viewbox to ensure they occupy the same space in the DOM. This will allow easy/proper alignment of elements. See exisitng svg's for examples.
|
// svg's should be constructed on the same canvas size/viewbox to ensure
|
||||||
|
// they occupy the same space in the DOM. This will allow easy/proper alignment of elements. See exisitng svg's for examples.
|
||||||
height: auto;
|
height: auto;
|
||||||
width: 6.5rem;
|
width: 6.5rem;
|
||||||
margin-bottom: 2.2rem;
|
margin-bottom: 2.2rem;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
class="loader"
|
class="loader"
|
||||||
role="alert"
|
role="alert"
|
||||||
aria-label="Loading new page"
|
aria-label="Loading new page"
|
||||||
v-bind:class="[this.loaderColor, this.loaderPosition]"></div>
|
:class="[loaderColor, loaderPosition]"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -23,7 +23,7 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.loader {
|
.loader {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import modalButtonMain from './modal-button-main';
|
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
|
import modalButtonMain from './modal-button-main';
|
||||||
|
|
||||||
describe('modal-button-main.vue', () => {
|
describe('modal-button-main.vue', () => {
|
||||||
it('Should return btn-primary class', () => {
|
it('Should return btn-primary class', () => {
|
||||||
// Arrange/Act
|
// Arrange/Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
isPrimary: true
|
isPrimary: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
const button = wrapper.find('button');
|
const button = wrapper.find('button');
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -22,14 +20,12 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it('Should return aria-disabled state', () => {
|
it('Should return aria-disabled state', () => {
|
||||||
// Arrange/Act
|
// Arrange/Act
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
isDisabled: true
|
isDisabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
const button = wrapper.find('button');
|
const button = wrapper.find('button');
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -38,15 +34,13 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it('Should return loader color', async () => {
|
it('Should return loader color', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderColor: 'blue',
|
loaderColor: 'blue',
|
||||||
loaderEnabled: true
|
loaderEnabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.clicked();
|
wrapper.vm.clicked();
|
||||||
|
|
@ -60,15 +54,13 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it('Should return loader position', async () => {
|
it('Should return loader position', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: 'right',
|
loaderPosition: 'right',
|
||||||
loaderEnabled: true
|
loaderEnabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.clicked();
|
wrapper.vm.clicked();
|
||||||
|
|
@ -81,15 +73,13 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it("Should set 'isLoaderDisplayed' to false when calling 'removeLoader'", async () => {
|
it("Should set 'isLoaderDisplayed' to false when calling 'removeLoader'", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: 'right',
|
loaderPosition: 'right',
|
||||||
loaderEnabled: true
|
loaderEnabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
isLoaderDisplayed: true
|
isLoaderDisplayed: true
|
||||||
|
|
@ -106,15 +96,13 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it("Should set 'isLoaderDisplayed' to false when calling 'resetButtonStyle'", async () => {
|
it("Should set 'isLoaderDisplayed' to false when calling 'resetButtonStyle'", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: 'right',
|
loaderPosition: 'right',
|
||||||
loaderEnabled: true
|
loaderEnabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
isLoaderDisplayed: true
|
isLoaderDisplayed: true
|
||||||
|
|
@ -130,16 +118,14 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it("Should emit 'click-event' event when clicking if the button is enabled", async () => {
|
it("Should emit 'click-event' event when clicking if the button is enabled", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: 'right',
|
loaderPosition: 'right',
|
||||||
loaderEnabled: true,
|
loaderEnabled: true,
|
||||||
isDisabled: false
|
isDisabled: false
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
const buttonElement = wrapper.find('button');
|
const buttonElement = wrapper.find('button');
|
||||||
|
|
||||||
|
|
@ -154,16 +140,14 @@ describe('modal-button-main.vue', () => {
|
||||||
|
|
||||||
it("Should not emit 'click-event' event when clicking if the button is disabled", async () => {
|
it("Should not emit 'click-event' event when clicking if the button is disabled", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(
|
const wrapper = shallowMount(modalButtonMain,
|
||||||
modalButtonMain,
|
|
||||||
setupMocks({
|
setupMocks({
|
||||||
propsData: {
|
propsData: {
|
||||||
loaderPosition: 'right',
|
loaderPosition: 'right',
|
||||||
loaderEnabled: true,
|
loaderEnabled: true,
|
||||||
isDisabled: true
|
isDisabled: true
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
const buttonElement = wrapper.find('button');
|
const buttonElement = wrapper.find('button');
|
||||||
|
|
||||||
|
|
@ -177,11 +161,13 @@ describe('modal-button-main.vue', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param mountOptionsMockData
|
||||||
|
*/
|
||||||
function setupMocks(mountOptionsMockData = {}) {
|
function setupMocks(mountOptionsMockData = {}) {
|
||||||
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
|
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
|
||||||
const baseMountOptions = getMountOptions(
|
const baseMountOptions = getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
|
||||||
Object.assign(defaultMountOptions, mountOptionsMockData)
|
|
||||||
);
|
|
||||||
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
|
||||||
|
|
||||||
return allMountOptions;
|
return allMountOptions;
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@
|
||||||
isLoaderDisplayed ? 'has-loader' : '',
|
isLoaderDisplayed ? 'has-loader' : '',
|
||||||
]"
|
]"
|
||||||
@click="clicked">
|
@click="clicked">
|
||||||
<span class="m-0">{{ this.buttonText }}</span>
|
<span class="m-0">{{ buttonText }}</span>
|
||||||
<loader
|
<loader
|
||||||
class="ms-2"
|
|
||||||
v-if="isLoaderDisplayed && !suppressLoader"
|
v-if="isLoaderDisplayed && !suppressLoader"
|
||||||
v-bind:class="[this.loaderColor, this.loaderPosition]" />
|
class="ms-2"
|
||||||
|
:class="[loaderColor, loaderPosition]" />
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -21,7 +21,10 @@
|
||||||
import loader from '@/ux-components/loader/loader';
|
import loader from '@/ux-components/loader/loader';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'modalButtonMain',
|
name: 'modal-button-main',
|
||||||
|
components: {
|
||||||
|
loader
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
isPrimary: Boolean,
|
isPrimary: Boolean,
|
||||||
buttonText: String,
|
buttonText: String,
|
||||||
|
|
@ -31,6 +34,7 @@ export default {
|
||||||
isFloat: Boolean,
|
isFloat: Boolean,
|
||||||
suppressLoader: Boolean
|
suppressLoader: Boolean
|
||||||
},
|
},
|
||||||
|
emits: ['click-event'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isLoaderDisplayed: false
|
isLoaderDisplayed: false
|
||||||
|
|
@ -41,12 +45,10 @@ export default {
|
||||||
this.isLoaderDisplayed = false;
|
this.isLoaderDisplayed = false;
|
||||||
},
|
},
|
||||||
clicked() {
|
clicked() {
|
||||||
this.pushEventToGA(
|
this.pushEventToGA(this.$route.query[this.queryStrings.ISS_PAGE],
|
||||||
this.$route.query[this.queryStrings.ISS_PAGE],
|
|
||||||
this.GaActions.CLICKED,
|
this.GaActions.CLICKED,
|
||||||
this.buttonText,
|
this.buttonText,
|
||||||
true
|
true);
|
||||||
);
|
|
||||||
if (!this.isDisabled) {
|
if (!this.isDisabled) {
|
||||||
this.isLoaderDisplayed = true;
|
this.isLoaderDisplayed = true;
|
||||||
this.$emit('click-event');
|
this.$emit('click-event');
|
||||||
|
|
@ -55,14 +57,11 @@ export default {
|
||||||
resetButtonStyle() {
|
resetButtonStyle() {
|
||||||
this.isLoaderDisplayed = false;
|
this.isLoaderDisplayed = false;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
components: {
|
|
||||||
loader
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.btn {
|
.btn {
|
||||||
&.btn-primary {
|
&.btn-primary {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -97,7 +96,7 @@ export default {
|
||||||
}
|
}
|
||||||
&.has-loader {
|
&.has-loader {
|
||||||
color: $white;
|
color: $white;
|
||||||
background: $blue-700;
|
background: $blue-700;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
&.delay {
|
&.delay {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ describe('radio.vue', () => {
|
||||||
const wrapper = shallowMount(radio, {
|
const wrapper = shallowMount(radio, {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
'$route': { query: { issPage: 'page-name' } },
|
$route: { query: { issPage: 'page-name' } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
propsData: {
|
propsData: {
|
||||||
|
|
@ -81,7 +81,8 @@ describe('radio.vue', () => {
|
||||||
});
|
});
|
||||||
wrapper.vm.handleCheckChange();
|
wrapper.vm.handleCheckChange();
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.emitted()['isCheckedChanged'][0]).toEqual([{'buttonID': 'List Card Checkbox', value: 'List Card Checkbox', checkValue: false}]);;
|
expect(wrapper.emitted().isCheckedChanged[0])
|
||||||
|
.toEqual([{ buttonID: 'List Card Checkbox', value: 'List Card Checkbox', checkValue: false }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should set checkValue data if selectedButtonIDs has value(s)', async () => {
|
it('Should set checkValue data if selectedButtonIDs has value(s)', async () => {
|
||||||
|
|
@ -89,7 +90,7 @@ describe('radio.vue', () => {
|
||||||
const wrapper = shallowMount(radio, {
|
const wrapper = shallowMount(radio, {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
'$route': { query: { issPage: 'page-name' } },
|
$route: { query: { issPage: 'page-name' } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
propsData: {
|
propsData: {
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,31 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- Checkbox groups MUST be wrapped in a <fieldset> and <legend> tag and must contain tabindex -->
|
<!-- Checkbox groups MUST be wrapped in a <fieldset> and <legend> tag and must contain tabindex -->
|
||||||
<div class="ui-radio form-check" :class="[(errors.length > 0 || hasError) ? 'has-error' : '']">
|
<div
|
||||||
<label class="d-inline-flex align-items-start form-check-label" :for="buttonID">
|
class="ui-radio form-check"
|
||||||
|
:class="[(errors.length > 0 || hasError) ? 'has-error' : '']">
|
||||||
|
<label
|
||||||
|
class="d-inline-flex align-items-start form-check-label"
|
||||||
|
:for="buttonID">
|
||||||
<input
|
<input
|
||||||
type="radio"
|
:id="buttonID"
|
||||||
class="form-check-input"
|
type="radio"
|
||||||
aria-checked="false"
|
class="form-check-input"
|
||||||
:name="groupName"
|
aria-checked="false"
|
||||||
:id="buttonID"
|
:name="groupName"
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:value="value"
|
:value="value"
|
||||||
:v-model="checkValue"
|
:v-model="checkValue"
|
||||||
@change="handleCheckChange"
|
:checked="checkValue"
|
||||||
:checked="checkValue"
|
:validationRules="validationRules"
|
||||||
:validationRules="validationRules"
|
@change="handleCheckChange" />
|
||||||
/>
|
<p
|
||||||
<p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p>
|
v-if="buttonLabel"
|
||||||
<span v-if="screenReaderOnlyText" class="sr-only">{{
|
class="m-0">{{ buttonLabel }}</p>
|
||||||
screenReaderOnlyText
|
<span
|
||||||
}}</span>
|
v-if="screenReaderOnlyText"
|
||||||
|
class="sr-only">
|
||||||
|
{{ screenReaderOnlyText }}
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -43,6 +50,24 @@ export default {
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
valueToLogType: String
|
valueToLogType: String
|
||||||
},
|
},
|
||||||
|
emits: ['isCheckedChanged', 'update:modelValue'],
|
||||||
|
setup(props) {
|
||||||
|
const inputType = 'radio';
|
||||||
|
const {
|
||||||
|
value: inputValue,
|
||||||
|
handleChange,
|
||||||
|
errors,
|
||||||
|
resetField
|
||||||
|
} = useField(props.groupName, props.validationRules, {
|
||||||
|
type: inputType
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
handleChange,
|
||||||
|
errors,
|
||||||
|
resetField
|
||||||
|
};
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
checkValue: Boolean
|
checkValue: Boolean
|
||||||
|
|
@ -56,6 +81,9 @@ export default {
|
||||||
this.checkValue = false;
|
this.checkValue = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
unmounted() {
|
||||||
|
this.resetField();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleCheckChange() {
|
handleCheckChange() {
|
||||||
this.handleChange(this.value);
|
this.handleChange(this.value);
|
||||||
|
|
@ -68,27 +96,6 @@ export default {
|
||||||
this.$emit('isCheckedChanged', emitEvent);
|
this.$emit('isCheckedChanged', emitEvent);
|
||||||
this.$emit('update:modelValue', emitEvent);
|
this.$emit('update:modelValue', emitEvent);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
setup(props) {
|
|
||||||
const inputType = 'radio';
|
|
||||||
const {
|
|
||||||
value: inputValue,
|
|
||||||
handleChange,
|
|
||||||
errors,
|
|
||||||
resetField
|
|
||||||
} = useField(props.groupName, props.validationRules,
|
|
||||||
{
|
|
||||||
type: inputType
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
handleChange,
|
|
||||||
errors,
|
|
||||||
resetField
|
|
||||||
};
|
|
||||||
},
|
|
||||||
unmounted() {
|
|
||||||
this.resetField();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,37 @@
|
||||||
<template>
|
<template>
|
||||||
<a v-if="linkType === 'navigation'" @click="handleClick" class="navigation-link" :href="href">
|
<a
|
||||||
{{text}}<slot name="after-text"></slot>
|
v-if="linkType === 'navigation'"
|
||||||
|
class="navigation-link"
|
||||||
|
:href="href"
|
||||||
|
@click="handleClick">
|
||||||
|
{{ text }}<slot name="after-text"></slot>
|
||||||
</a>
|
</a>
|
||||||
<a v-else-if="linkType === 'footer'" @click="handleClick" class="footer-link" :href="href" target="_blank">
|
<a
|
||||||
{{text}}<slot name="after-text"></slot>
|
v-else-if="linkType === 'footer'"
|
||||||
|
class="footer-link"
|
||||||
|
:href="href"
|
||||||
|
target="_blank"
|
||||||
|
@click="handleClick">
|
||||||
|
{{ text }}<slot name="after-text"></slot>
|
||||||
</a>
|
</a>
|
||||||
<a v-else-if="linkType === 'textSmall'" @click="handleClick" class="small" :href="href">
|
<a
|
||||||
{{text}}<slot name="after-text"></slot>
|
v-else-if="linkType === 'textSmall'"
|
||||||
|
class="small"
|
||||||
|
:href="href"
|
||||||
|
@click="handleClick">
|
||||||
|
{{ text }}<slot name="after-text"></slot>
|
||||||
</a>
|
</a>
|
||||||
<a v-else-if="linkType === 'text'" @click="handleClick" :href="href">
|
<a
|
||||||
{{text}}<slot name="after-text"></slot>
|
v-else-if="linkType === 'text'"
|
||||||
|
:href="href"
|
||||||
|
@click="handleClick">
|
||||||
|
{{ text }}<slot name="after-text"></slot>
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'textLink',
|
name: 'text-link',
|
||||||
props: {
|
props: {
|
||||||
linkType: String,
|
linkType: String,
|
||||||
text: String,
|
text: String,
|
||||||
|
|
@ -23,21 +39,20 @@ export default {
|
||||||
type: String
|
type: String
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
emits: ['click-event'],
|
||||||
methods: {
|
methods: {
|
||||||
handleClick(event) {
|
handleClick() {
|
||||||
this.pushEventToGA(
|
this.pushEventToGA(this.$route.query[this.queryStrings.ISS_PAGE],
|
||||||
this.$route.query[this.queryStrings.ISS_PAGE],
|
|
||||||
this.GaActions.CLICKED,
|
this.GaActions.CLICKED,
|
||||||
this.text,
|
this.text,
|
||||||
true
|
true);
|
||||||
);
|
|
||||||
this.$emit('click-event');
|
this.$emit('click-event');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
a {
|
a {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
text-underline-offset: 5px;
|
text-underline-offset: 5px;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue