Commit ccbf8904 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'dz/fix-tooltip-on-storage' into 'master'

Hide tooltip on Storage purchase if not prorated

See merge request gitlab-org/gitlab!78537
parents 5781636d 5bc8c1b0
<script> <script>
import emptySvg from '@gitlab/svgs/dist/illustrations/security-dashboard-empty-state.svg'; import emptySvg from '@gitlab/svgs/dist/illustrations/security-dashboard-empty-state.svg';
import { GlEmptyState, GlIcon, GlAlert, GlTooltipDirective } from '@gitlab/ui'; import { GlEmptyState, GlAlert } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import OrderSummary from 'ee/subscriptions/buy_addons_shared/components/order_summary.vue'; import OrderSummary from 'ee/subscriptions/buy_addons_shared/components/order_summary.vue';
import { ERROR_FETCHING_DATA_HEADER, ERROR_FETCHING_DATA_DESCRIPTION } from '~/ensure_data'; import { ERROR_FETCHING_DATA_HEADER, ERROR_FETCHING_DATA_DESCRIPTION } from '~/ensure_data';
...@@ -17,13 +17,9 @@ export default { ...@@ -17,13 +17,9 @@ export default {
AddonPurchaseDetails, AddonPurchaseDetails,
Checkout, Checkout,
GlEmptyState, GlEmptyState,
GlIcon,
GlAlert, GlAlert,
OrderSummary, OrderSummary,
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
props: { props: {
config: { config: {
required: true, required: true,
...@@ -173,15 +169,6 @@ export default { ...@@ -173,15 +169,6 @@ export default {
<template #price-per-unit="{ price }"> <template #price-per-unit="{ price }">
{{ pricePerUnitLabel(price) }} {{ pricePerUnitLabel(price) }}
</template> </template>
<template #tooltip>
<gl-icon
v-gl-tooltip.right
:title="config.tooltipNote"
:aria-label="config.tooltipNote"
role="tooltip"
name="question"
/>
</template>
</order-summary> </order-summary>
</div> </div>
</div> </div>
......
...@@ -159,9 +159,6 @@ export default { ...@@ -159,9 +159,6 @@ export default {
<template #price-per-unit="{ price }"> <template #price-per-unit="{ price }">
<slot name="price-per-unit" :price="price"></slot> <slot name="price-per-unit" :price="price"></slot>
</template> </template>
<template #tooltip>
<slot name="tooltip"></slot>
</template>
</summary-details> </summary-details>
</gl-collapse> </gl-collapse>
</div> </div>
...@@ -184,9 +181,6 @@ export default { ...@@ -184,9 +181,6 @@ export default {
<template #price-per-unit="{ price }"> <template #price-per-unit="{ price }">
<slot name="price-per-unit" :price="price"></slot> <slot name="price-per-unit" :price="price"></slot>
</template> </template>
<template #tooltip>
<slot name="tooltip"></slot>
</template>
</summary-details> </summary-details>
</div> </div>
</div> </div>
......
<script> <script>
import { GlLink, GlSprintf } from '@gitlab/ui'; import { GlLink, GlIcon, GlTooltipDirective, GlSprintf } from '@gitlab/ui';
import formattingMixins from 'ee/subscriptions/new/formatting_mixins'; import formattingMixins from 'ee/subscriptions/new/formatting_mixins';
import { formatNumber } from '~/locale'; import { formatNumber } from '~/locale';
import { import {
...@@ -9,12 +9,17 @@ import { ...@@ -9,12 +9,17 @@ import {
I18N_SUMMARY_TAX, I18N_SUMMARY_TAX,
I18N_SUMMARY_TAX_NOTE, I18N_SUMMARY_TAX_NOTE,
I18N_SUMMARY_TOTAL, I18N_SUMMARY_TOTAL,
I18N_STORAGE_TOOLTIP_NOTE,
} from '../../constants'; } from '../../constants';
export default { export default {
components: { components: {
GlLink, GlLink,
GlSprintf, GlSprintf,
GlIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
}, },
mixins: [formattingMixins], mixins: [formattingMixins],
props: { props: {
...@@ -93,6 +98,7 @@ export default { ...@@ -93,6 +98,7 @@ export default {
tax: I18N_SUMMARY_TAX, tax: I18N_SUMMARY_TAX,
taxNote: I18N_SUMMARY_TAX_NOTE, taxNote: I18N_SUMMARY_TAX_NOTE,
total: I18N_SUMMARY_TOTAL, total: I18N_SUMMARY_TOTAL,
tooltipNote: I18N_STORAGE_TOOLTIP_NOTE,
}, },
}; };
</script> </script>
...@@ -120,7 +126,14 @@ export default { ...@@ -120,7 +126,14 @@ export default {
endDate: formatDate(endDate), endDate: formatDate(endDate),
}) })
}} }}
<slot name="tooltip"></slot> <gl-icon
v-if="subscriptionEndDate"
v-gl-tooltip.right
:title="$options.i18n.tooltipNote"
:aria-label="$options.i18n.tooltipNote"
role="tooltip"
name="question"
/>
</div> </div>
</div> </div>
<div class="gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid gl-py-3"> <div class="gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid gl-py-3">
......
...@@ -38,7 +38,6 @@ export default { ...@@ -38,7 +38,6 @@ export default {
summaryTitle: i18nCIMinutesSummaryTitle, summaryTitle: i18nCIMinutesSummaryTitle,
summaryTotal: I18N_CI_MINUTES_SUMMARY_TOTAL, summaryTotal: I18N_CI_MINUTES_SUMMARY_TOTAL,
title: I18N_CI_MINUTES_TITLE, title: I18N_CI_MINUTES_TITLE,
tooltipNote: '',
}; };
}, },
}, },
......
...@@ -10,7 +10,6 @@ import { ...@@ -10,7 +10,6 @@ import {
I18N_STORAGE_SUMMARY_TOTAL, I18N_STORAGE_SUMMARY_TOTAL,
I18N_STORAGE_TITLE, I18N_STORAGE_TITLE,
I18N_STORAGE_PRICE_PER_UNIT, I18N_STORAGE_PRICE_PER_UNIT,
I18N_STORAGE_TOOLTIP_NOTE,
planTags, planTags,
STORAGE_PER_PACK, STORAGE_PER_PACK,
} from 'ee/subscriptions/buy_addons_shared/constants'; } from 'ee/subscriptions/buy_addons_shared/constants';
...@@ -39,7 +38,6 @@ export default { ...@@ -39,7 +38,6 @@ export default {
summaryTitle: i18nStorageSummaryTitle, summaryTitle: i18nStorageSummaryTitle,
summaryTotal: I18N_STORAGE_SUMMARY_TOTAL, summaryTotal: I18N_STORAGE_SUMMARY_TOTAL,
title: I18N_STORAGE_TITLE, title: I18N_STORAGE_TITLE,
tooltipNote: I18N_STORAGE_TOOLTIP_NOTE,
}; };
}, },
}, },
......
...@@ -21,7 +21,6 @@ import { ...@@ -21,7 +21,6 @@ import {
I18N_STORAGE_SUMMARY_TOTAL, I18N_STORAGE_SUMMARY_TOTAL,
I18N_STORAGE_TITLE, I18N_STORAGE_TITLE,
I18N_STORAGE_PRICE_PER_UNIT, I18N_STORAGE_PRICE_PER_UNIT,
I18N_STORAGE_TOOLTIP_NOTE,
I18N_API_ERROR, I18N_API_ERROR,
planTags, planTags,
STORAGE_PER_PACK, STORAGE_PER_PACK,
...@@ -71,7 +70,6 @@ describe('Buy Addons Shared App', () => { ...@@ -71,7 +70,6 @@ describe('Buy Addons Shared App', () => {
summaryTitle: i18nStorageSummaryTitle, summaryTitle: i18nStorageSummaryTitle,
summaryTotal: I18N_STORAGE_SUMMARY_TOTAL, summaryTotal: I18N_STORAGE_SUMMARY_TOTAL,
title: I18N_STORAGE_TITLE, title: I18N_STORAGE_TITLE,
tooltipNote: I18N_STORAGE_TOOLTIP_NOTE,
}, },
tags: [planTags.STORAGE_PLAN], tags: [planTags.STORAGE_PLAN],
}; };
...@@ -89,7 +87,6 @@ describe('Buy Addons Shared App', () => { ...@@ -89,7 +87,6 @@ describe('Buy Addons Shared App', () => {
summaryTitle: i18nCIMinutesSummaryTitle, summaryTitle: i18nCIMinutesSummaryTitle,
summaryTotal: I18N_CI_MINUTES_SUMMARY_TOTAL, summaryTotal: I18N_CI_MINUTES_SUMMARY_TOTAL,
title: I18N_CI_MINUTES_TITLE, title: I18N_CI_MINUTES_TITLE,
tooltipNote: '',
}, },
tags: [planTags.CI_1000_MINUTES_PLAN], tags: [planTags.CI_1000_MINUTES_PLAN],
}; };
......
import { GlSprintf } from '@gitlab/ui'; import { GlSprintf, GlIcon } from '@gitlab/ui';
import SummaryDetails from 'ee/subscriptions/buy_addons_shared/components/order_summary/summary_details.vue'; import SummaryDetails from 'ee/subscriptions/buy_addons_shared/components/order_summary/summary_details.vue';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { useFakeDate } from 'helpers/fake_date'; import { useFakeDate } from 'helpers/fake_date';
...@@ -21,6 +21,7 @@ describe('SummaryDetails', () => { ...@@ -21,6 +21,7 @@ describe('SummaryDetails', () => {
}, },
stubs: { stubs: {
GlSprintf, GlSprintf,
GlIcon,
}, },
}); });
}; };
...@@ -32,6 +33,7 @@ describe('SummaryDetails', () => { ...@@ -32,6 +33,7 @@ describe('SummaryDetails', () => {
const findVat = () => wrapper.findByTestId('vat'); const findVat = () => wrapper.findByTestId('vat');
const findVatHelpLink = () => wrapper.findByTestId('vat-help-link'); const findVatHelpLink = () => wrapper.findByTestId('vat-help-link');
const findVatInfoLine = () => wrapper.findByTestId('vat-info-line'); const findVatInfoLine = () => wrapper.findByTestId('vat-info-line');
const findToolip = () => wrapper.findComponent(GlIcon);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -93,6 +95,10 @@ describe('SummaryDetails', () => { ...@@ -93,6 +95,10 @@ describe('SummaryDetails', () => {
expect(findSubscriptionPeriod().isVisible()).toBe(true); expect(findSubscriptionPeriod().isVisible()).toBe(true);
expect(findSubscriptionPeriod().text()).toBe('Jan 16, 2021 - Jan 16, 2022'); expect(findSubscriptionPeriod().text()).toBe('Jan 16, 2021 - Jan 16, 2022');
}); });
it('hides a tooltip', () => {
expect(findToolip().exists()).toBe(false);
});
}); });
describe('when subscription has expiration and the end date provided', () => { describe('when subscription has expiration and the end date provided', () => {
...@@ -104,6 +110,10 @@ describe('SummaryDetails', () => { ...@@ -104,6 +110,10 @@ describe('SummaryDetails', () => {
expect(findSubscriptionPeriod().isVisible()).toBe(true); expect(findSubscriptionPeriod().isVisible()).toBe(true);
expect(findSubscriptionPeriod().text()).toBe('Jan 16, 2021 - Feb 6, 2021'); expect(findSubscriptionPeriod().text()).toBe('Jan 16, 2021 - Feb 6, 2021');
}); });
it('shows a tooltip', () => {
expect(findToolip().isVisible()).toBe(true);
});
}); });
describe('when subscription does not have expiration', () => { describe('when subscription does not have expiration', () => {
......
...@@ -51,7 +51,6 @@ describe('Buy Minutes App', () => { ...@@ -51,7 +51,6 @@ describe('Buy Minutes App', () => {
summaryTitle: i18nCIMinutesSummaryTitle, summaryTitle: i18nCIMinutesSummaryTitle,
summaryTotal: I18N_CI_MINUTES_SUMMARY_TOTAL, summaryTotal: I18N_CI_MINUTES_SUMMARY_TOTAL,
title: I18N_CI_MINUTES_TITLE, title: I18N_CI_MINUTES_TITLE,
tooltipNote: '',
}); });
}); });
}); });
...@@ -11,7 +11,6 @@ import { ...@@ -11,7 +11,6 @@ import {
I18N_STORAGE_SUMMARY_TOTAL, I18N_STORAGE_SUMMARY_TOTAL,
I18N_STORAGE_TITLE, I18N_STORAGE_TITLE,
I18N_STORAGE_PRICE_PER_UNIT, I18N_STORAGE_PRICE_PER_UNIT,
I18N_STORAGE_TOOLTIP_NOTE,
planTags, planTags,
STORAGE_PER_PACK, STORAGE_PER_PACK,
} from 'ee/subscriptions/buy_addons_shared/constants'; } from 'ee/subscriptions/buy_addons_shared/constants';
...@@ -51,7 +50,6 @@ describe('Buy Storage App', () => { ...@@ -51,7 +50,6 @@ describe('Buy Storage App', () => {
summaryTitle: i18nStorageSummaryTitle, summaryTitle: i18nStorageSummaryTitle,
summaryTotal: I18N_STORAGE_SUMMARY_TOTAL, summaryTotal: I18N_STORAGE_SUMMARY_TOTAL,
title: I18N_STORAGE_TITLE, title: I18N_STORAGE_TITLE,
tooltipNote: I18N_STORAGE_TOOLTIP_NOTE,
}); });
}); });
}); });
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