Merge pull request #192 from Safelite/CSR-257-funnel-footer-updates
CSR-257 update how button and text link wrap and stack.
This commit is contained in:
commit
0fe50fb780
5 changed files with 79 additions and 24 deletions
|
|
@ -5,9 +5,17 @@ describe("funnel-footer.vue", () => {
|
||||||
|
|
||||||
it("Should return footer-link class", async () => {
|
it("Should return footer-link class", async () => {
|
||||||
// Act
|
// Act
|
||||||
try {
|
|
||||||
|
const r = {
|
||||||
|
test:"testing",
|
||||||
|
clientHeight: 10,
|
||||||
|
classList: {
|
||||||
|
add: jest.fn(() => ''),
|
||||||
|
remove: jest.fn()
|
||||||
|
},
|
||||||
|
};
|
||||||
global.document.getElementById = jest.fn().mockImplementation(()=> {
|
global.document.getElementById = jest.fn().mockImplementation(()=> {
|
||||||
return {}
|
return r;
|
||||||
});
|
});
|
||||||
|
|
||||||
const wrapper = mount(funnelFooter, {
|
const wrapper = mount(funnelFooter, {
|
||||||
|
|
@ -22,9 +30,8 @@ describe("funnel-footer.vue", () => {
|
||||||
// Expect
|
// Expect
|
||||||
expect(link.attributes('class')).toContain("footer-link");
|
expect(link.attributes('class')).toContain("footer-link");
|
||||||
expect(global.document.getElementById).toBeCalled();
|
expect(global.document.getElementById).toBeCalled();
|
||||||
} catch(error) {
|
expect(r.classList.add).toBeCalledWith("justify-content-end");
|
||||||
console.log(error);
|
expect(r.classList.remove).toBeCalledWith("justify-content-start");
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -57,4 +64,32 @@ describe("funnel-footer.vue", () => {
|
||||||
expect(input.attributes("class")).toContain("btn-primary");
|
expect(input.attributes("class")).toContain("btn-primary");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should return class justify-content-end if paddingHeight < 80px", async () => {
|
||||||
|
|
||||||
|
global.document.getElementById = jest.fn().mockImplementation(()=> {
|
||||||
|
return {
|
||||||
|
test:"testing",
|
||||||
|
clientHeight: 10,
|
||||||
|
classList: {
|
||||||
|
add: jest.fn(),
|
||||||
|
remove: jest.fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = mount(funnelFooter, {
|
||||||
|
propsData: {
|
||||||
|
footer: true
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const infoBox = document.getElementById('infoBox');
|
||||||
|
// Assert
|
||||||
|
const stacked = wrapper.find("#stacked");
|
||||||
|
wrapper.vm.paddingHeight = 100;
|
||||||
|
|
||||||
|
// Expect
|
||||||
|
expect(stacked.attributes('class')).toContain("justify-content-end");
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container-fluid fixed-bottom g-4 bg-light py-4" id="infoBox">
|
<div class="container-fluid fixed-bottom g-4 bg-light py-4" id="infoBox">
|
||||||
<div class="row">
|
<div class="row d-flex flex-row-reverse align-items-center">
|
||||||
<div class="col">
|
<div class="col d-flex justify-content-end" id="stacked">
|
||||||
<buttonMain
|
<buttonMain
|
||||||
isPrimary
|
isPrimary
|
||||||
buttonText="Review Appointment Details"
|
buttonText="Button test"
|
||||||
loaderColor="white"
|
loaderColor="white"
|
||||||
sizeInRem="1"
|
sizeInRem="1"
|
||||||
isFloat
|
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
<textLink
|
<textLink
|
||||||
navigation=true
|
navigation=true
|
||||||
text="back"
|
text="back"
|
||||||
|
|
@ -68,6 +69,7 @@ export default {
|
||||||
setTimeout(function(){ // Give it a moment to set the date
|
setTimeout(function(){ // Give it a moment to set the date
|
||||||
document.getElementById('years').innerHTML += new Date().getFullYear();
|
document.getElementById('years').innerHTML += new Date().getFullYear();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
this.checkHeight();
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
window.removeEventListener('resize', this.onResize);
|
window.removeEventListener('resize', this.onResize);
|
||||||
|
|
@ -75,7 +77,28 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
onResize() {
|
onResize() {
|
||||||
this.paddingHeight = document.getElementById("infoBox").offsetHeight;
|
this.paddingHeight = document.getElementById("infoBox").offsetHeight;
|
||||||
|
this.checkHeight();
|
||||||
|
},
|
||||||
|
checkHeight() {
|
||||||
|
const parentHeight = document.getElementById('infoBox').clientHeight;
|
||||||
|
const wrapper2 = document.getElementById('stacked');
|
||||||
|
console.log(parentHeight);
|
||||||
|
console.log(wrapper2);
|
||||||
|
if (parentHeight > 80) {
|
||||||
|
wrapper2.classList.add("justify-content-start");
|
||||||
|
wrapper2.classList.remove("justify-content-end");
|
||||||
|
} else {
|
||||||
|
wrapper2.classList.add("justify-content-end");
|
||||||
|
wrapper2.classList.remove("justify-content-start");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
button {
|
||||||
|
min-width: 200px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
<div class="row g-2">
|
<div class="row g-2">
|
||||||
<listCard
|
<listCard
|
||||||
isMultiSelect
|
isMultiSelect
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Checkbox 1"
|
buttonID="List Card Checkbox 1"
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
/>
|
/>
|
||||||
<listCard
|
<listCard
|
||||||
isMultiSelect
|
isMultiSelect
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Checkbox 3"
|
buttonID="List Card Checkbox 3"
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
<legend class="sr-only">Functioning as Checkbox</legend>
|
<legend class="sr-only">Functioning as Checkbox</legend>
|
||||||
<listCard
|
<listCard
|
||||||
isMultiSelect
|
isMultiSelect
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Checkbox"
|
buttonID="List Card Checkbox"
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
<legend class="sr-only">Checkbox no Description</legend>
|
<legend class="sr-only">Checkbox no Description</legend>
|
||||||
<listCard
|
<listCard
|
||||||
isMultiSelect
|
isMultiSelect
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Checkbox b"
|
buttonID="List Card Checkbox b"
|
||||||
|
|
@ -149,7 +149,7 @@
|
||||||
<legend class="sr-only">Functioning as Radio Button</legend>
|
<legend class="sr-only">Functioning as Radio Button</legend>
|
||||||
<listCard
|
<listCard
|
||||||
isRadio
|
isRadio
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Radio Button"
|
buttonID="List Card Radio Button"
|
||||||
|
|
@ -166,7 +166,7 @@
|
||||||
<legend class="sr-only">Radio Button no Description</legend>
|
<legend class="sr-only">Radio Button no Description</legend>
|
||||||
<listCard
|
<listCard
|
||||||
isRadio
|
isRadio
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Radio Button b"
|
buttonID="List Card Radio Button b"
|
||||||
|
|
@ -184,7 +184,7 @@
|
||||||
<listCard
|
<listCard
|
||||||
isMultiSelect
|
isMultiSelect
|
||||||
isWide
|
isWide
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Horizontal Checkbox"
|
buttonID="List Card Horizontal Checkbox"
|
||||||
|
|
@ -219,7 +219,7 @@
|
||||||
<legend class="sr-only">Horizontal Radio Button</legend>
|
<legend class="sr-only">Horizontal Radio Button</legend>
|
||||||
<listCard
|
<listCard
|
||||||
isWide
|
isWide
|
||||||
buttonImage="back-glass-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Rear Window"
|
buttonLabel="Rear Window"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Horizontal Radio Button"
|
buttonID="List Card Horizontal Radio Button"
|
||||||
|
|
@ -236,7 +236,7 @@
|
||||||
<legend class="sr-only">Radio Button no Description</legend>
|
<legend class="sr-only">Radio Button no Description</legend>
|
||||||
<listCard
|
<listCard
|
||||||
isWide
|
isWide
|
||||||
buttonImage="windshield-damage.svg"
|
buttonImage="https://digitalconsumercms-dev.safelite.com/images/default-source/damage-options/car.svg?sfvrsn=1468d7f1_3"
|
||||||
buttonLabel="Windshield"
|
buttonLabel="Windshield"
|
||||||
altText=""
|
altText=""
|
||||||
buttonID="List Card Horizontal Radio Button b"
|
buttonID="List Card Horizontal Radio Button b"
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export default {
|
||||||
border-radius: $border-radius-lg;
|
border-radius: $border-radius-lg;
|
||||||
color: $white;
|
color: $white;
|
||||||
transition: all 150ms linear;
|
transition: all 150ms linear;
|
||||||
white-space: nowrap;
|
justify-content: center;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
270deg,
|
270deg,
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ export default {
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
a {
|
a {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
text-decoration: none;
|
text-underline-offset: 0.5em;
|
||||||
border-bottom: 1px solid $blue;
|
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
padding: 0 0 4px 0;
|
padding: 0 0 4px 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
@ -45,7 +44,6 @@ a {
|
||||||
}
|
}
|
||||||
&.navigation-link {
|
&.navigation-link {
|
||||||
color: $black;
|
color: $black;
|
||||||
border-bottom: 1px solid $black;
|
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
@ -54,14 +52,13 @@ a {
|
||||||
&.footer-link {
|
&.footer-link {
|
||||||
color: $gray-600;
|
color: $gray-600;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
border-bottom: 1px solid transparent;
|
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
padding: 0 0 2px 0;
|
padding: 0 0 2px 0;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
&:hover {
|
&:hover {
|
||||||
border-bottom: 1px solid $gray-500;
|
|
||||||
padding: 0 0 2px 0;
|
padding: 0 0 2px 0;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue