Commit f2d705dd authored by Vitaly Slobodin's avatar Vitaly Slobodin

Fix OrderSummary cmp

parent 23cdfdc1
...@@ -21,15 +21,14 @@ export default { ...@@ -21,15 +21,14 @@ export default {
apollo: { apollo: {
state: { state: {
query: STATE_QUERY, query: STATE_QUERY,
update(data) { manual: true,
return data;
},
result({ data }) { result({ data }) {
this.subscription = data.subscription; this.subscription = data.subscription;
this.namespaces = data.namespaces; this.namespaces = data.namespaces;
this.isSetupForCompany = data.isSetupForCompany; this.isSetupForCompany = data.isSetupForCompany;
this.fullName = data.fullName; this.fullName = data.fullName;
this.customer = data.customer; this.customer = data.customer;
this.selectedPlanId = data.selectedPlanId;
}, },
}, },
}, },
...@@ -41,11 +40,12 @@ export default { ...@@ -41,11 +40,12 @@ export default {
collapsed: true, collapsed: true,
fullName: null, fullName: null,
customer: {}, customer: {},
selectedPlanId: null,
}; };
}, },
computed: { computed: {
selectedPlan() { selectedPlan() {
return this.plans.find((plan) => plan.code === this.subscription.planId); return this.plans.find((plan) => plan.code === this.selectedPlanId);
}, },
selectedPlanPrice() { selectedPlanPrice() {
return this.selectedPlan.pricePerYear; return this.selectedPlan.pricePerYear;
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
</script> </script>
<template> <template>
<div <div
v-if="!$apollo.loading && (!isGroupSelected || isSelectedGroupPresent)" v-if="!$apollo.loading && (!isGroupSelected || isSelectedGroupPresent) && selectedPlan"
class="order-summary gl-display-flex gl-flex-direction-column gl-flex-grow-1 gl-mt-2 mt-lg-5" class="order-summary gl-display-flex gl-flex-direction-column gl-flex-grow-1 gl-mt-2 mt-lg-5"
> >
<div class="d-lg-none"> <div class="d-lg-none">
......
...@@ -17,7 +17,7 @@ localVue.use(VueApollo); ...@@ -17,7 +17,7 @@ localVue.use(VueApollo);
describe('Order Summary', () => { describe('Order Summary', () => {
const resolvers = { ...purchaseFlowResolvers, ...subscriptionsResolvers }; const resolvers = { ...purchaseFlowResolvers, ...subscriptionsResolvers };
const initialStateData = { const initialStateData = {
subscription: { planId: 'silver' }, selectedPlanId: 'silver',
}; };
let wrapper; let wrapper;
...@@ -105,7 +105,8 @@ describe('Order Summary', () => { ...@@ -105,7 +105,8 @@ describe('Order Summary', () => {
describe('the default plan', () => { describe('the default plan', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
subscription: { planId: 'bronze', quantity: 1 }, subscription: { quantity: 1 },
selectedPlanId: 'bronze',
}); });
}); });
...@@ -126,7 +127,8 @@ describe('Order Summary', () => { ...@@ -126,7 +127,8 @@ describe('Order Summary', () => {
describe('Changing the number of users', () => { describe('Changing the number of users', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
subscription: { planId: 'silver', quantity: 1 }, subscription: { quantity: 1 },
selectedPlanId: 'silver',
}); });
}); });
...@@ -151,7 +153,8 @@ describe('Order Summary', () => { ...@@ -151,7 +153,8 @@ describe('Order Summary', () => {
describe('3 selected users', () => { describe('3 selected users', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
subscription: { planId: 'silver', quantity: 3 }, subscription: { quantity: 3 },
selectedPlanId: 'silver',
}); });
}); });
...@@ -175,7 +178,8 @@ describe('Order Summary', () => { ...@@ -175,7 +178,8 @@ describe('Order Summary', () => {
describe('no selected users', () => { describe('no selected users', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
subscription: { planId: 'silver', quantity: 0 }, subscription: { quantity: 0 },
selectedPlanId: 'silver',
}); });
}); });
......
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