Commit 21387d24 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'dreedy-be-explicit-as-to-which-props-a-vue-component-takes' into 'master'

Be explicit about which props a Vue component takes

See merge request gitlab-org/gitlab!59048
parents 9d94d1db e1cf3899
......@@ -7,16 +7,26 @@ export const initTrialStatusWidget = () => {
if (!el) return undefined;
const { daysRemaining, percentageComplete, ...props } = el.dataset;
const {
containerId,
daysRemaining,
navIconImagePath,
percentageComplete,
planName,
plansHref,
} = el.dataset;
return new Vue({
el,
render: (createElement) =>
createElement(TrialStatusWidget, {
props: {
...props,
containerId,
daysRemaining: Number(daysRemaining),
navIconImagePath,
percentageComplete: Number(percentageComplete),
planName,
plansHref,
},
}),
});
......@@ -27,14 +37,27 @@ export const initTrialStatusPopover = () => {
if (!el) return undefined;
const { trialEndDate, ...props } = el.dataset;
const {
containerId,
groupName,
planName,
plansHref,
purchaseHref,
targetId,
trialEndDate,
} = el.dataset;
return new Vue({
el,
render: (createElement) =>
createElement(TrialStatusPopover, {
props: {
...props,
containerId,
groupName,
planName,
plansHref,
purchaseHref,
targetId,
trialEndDate: new Date(trialEndDate),
},
}),
......
......@@ -8,7 +8,7 @@ describe('TrialStatusWidget component', () => {
const getGlLink = () => wrapper.findComponent(GlLink);
const createComponent = ({ props } = {}) => {
const createComponent = (props = {}) => {
return shallowMount(TrialStatusWidget, {
propsData: {
daysRemaining: 20,
......@@ -49,7 +49,7 @@ describe('TrialStatusWidget component', () => {
describe('with the optional containerId prop', () => {
beforeEach(() => {
wrapper = createComponent({ props: { containerId: 'some-id' } });
wrapper = createComponent({ containerId: 'some-id' });
});
it('renders with the given id', () => {
......
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