Commit 3a007480 authored by Dallas Reedy's avatar Dallas Reedy Committed by Kushal Pandya

Use provide for unchanging values in trial status components

parent c73e8e6e
...@@ -23,36 +23,14 @@ export default { ...@@ -23,36 +23,14 @@ export default {
GlSprintf, GlSprintf,
}, },
mixins: [trackingMixin], mixins: [trackingMixin],
props: { inject: {
containerId: { containerId: { default: null },
type: [String, null], groupName: {},
required: false, planName: {},
default: null, plansHref: {},
}, purchaseHref: {},
groupName: { targetId: {},
type: String, trialEndDate: {},
required: true,
},
planName: {
type: String,
required: true,
},
plansHref: {
type: String,
required: true,
},
purchaseHref: {
type: String,
required: true,
},
targetId: {
type: String,
required: true,
},
trialEndDate: {
type: Date,
required: true,
},
}, },
data() { data() {
return { return {
......
...@@ -13,32 +13,13 @@ export default { ...@@ -13,32 +13,13 @@ export default {
GlProgressBar, GlProgressBar,
}, },
mixins: [trackingMixin], mixins: [trackingMixin],
props: { inject: {
containerId: { containerId: { default: null },
type: [String, null], daysRemaining: {},
required: false, navIconImagePath: {},
default: null, percentageComplete: {},
}, planName: {},
daysRemaining: { plansHref: {},
type: Number,
required: true,
},
navIconImagePath: {
type: String,
required: true,
},
percentageComplete: {
type: Number,
required: true,
},
planName: {
type: String,
required: true,
},
plansHref: {
type: String,
required: true,
},
}, },
i18n, i18n,
trackingEvents, trackingEvents,
......
...@@ -18,17 +18,15 @@ export const initTrialStatusWidget = () => { ...@@ -18,17 +18,15 @@ export const initTrialStatusWidget = () => {
return new Vue({ return new Vue({
el, el,
render: (createElement) => provide: {
createElement(TrialStatusWidget, { containerId,
props: { daysRemaining: Number(daysRemaining),
containerId, navIconImagePath,
daysRemaining: Number(daysRemaining), percentageComplete: Number(percentageComplete),
navIconImagePath, planName,
percentageComplete: Number(percentageComplete), plansHref,
planName, },
plansHref, render: (createElement) => createElement(TrialStatusWidget),
},
}),
}); });
}; };
...@@ -49,18 +47,16 @@ export const initTrialStatusPopover = () => { ...@@ -49,18 +47,16 @@ export const initTrialStatusPopover = () => {
return new Vue({ return new Vue({
el, el,
render: (createElement) => provide: {
createElement(TrialStatusPopover, { containerId,
props: { groupName,
containerId, planName,
groupName, plansHref,
planName, purchaseHref,
plansHref, targetId,
purchaseHref, trialEndDate: new Date(trialEndDate),
targetId, },
trialEndDate: new Date(trialEndDate), render: (createElement) => createElement(TrialStatusPopover),
},
}),
}); });
}; };
......
...@@ -26,7 +26,7 @@ describe('TrialStatusPopover component', () => { ...@@ -26,7 +26,7 @@ describe('TrialStatusPopover component', () => {
const createComponent = (mountFn = shallowMount) => { const createComponent = (mountFn = shallowMount) => {
return mountFn(TrialStatusPopover, { return mountFn(TrialStatusPopover, {
propsData: { provide: {
groupName: 'Some Test Group', groupName: 'Some Test Group',
planName: 'Ultimate', planName: 'Ultimate',
plansHref: 'billing/path-for/group', plansHref: 'billing/path-for/group',
......
...@@ -11,15 +11,15 @@ describe('TrialStatusWidget component', () => { ...@@ -11,15 +11,15 @@ describe('TrialStatusWidget component', () => {
const findGlLink = () => wrapper.findComponent(GlLink); const findGlLink = () => wrapper.findComponent(GlLink);
const createComponent = (props = {}) => { const createComponent = (providers = {}) => {
return shallowMount(TrialStatusWidget, { return shallowMount(TrialStatusWidget, {
propsData: { provide: {
daysRemaining: 20, daysRemaining: 20,
navIconImagePath: 'illustrations/golden_tanuki.svg', navIconImagePath: 'illustrations/golden_tanuki.svg',
percentageComplete: 10, percentageComplete: 10,
planName: 'Ultimate', planName: 'Ultimate',
plansHref: 'billing/path-for/group', plansHref: 'billing/path-for/group',
...props, ...providers,
}, },
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment