Commit 457de103 authored by Zack Cuddy's avatar Zack Cuddy Committed by Brandon Labuschagne

Geo - Fix missing help text

There was a regression
where the help text and
link dissapeared from
the empty state component.

This change fixes that and
adds some specs to avoid
the regression in the future.
parent 1a633aa5
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { GlEmptyState } from '@gitlab/ui'; import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
export default { export default {
name: 'GeoReplicableEmptyState', name: 'GeoReplicableEmptyState',
components: { components: {
GlEmptyState, GlEmptyState,
GlSprintf,
GlLink,
}, },
props: { props: {
geoReplicableEmptySvgPath: { geoReplicableEmptySvgPath: {
......
---
title: Geo Replicables - Fix missing help text
merge_request: 48378
author:
type: fixed
import { GlEmptyState } from '@gitlab/ui'; import { createLocalVue, mount } from '@vue/test-utils';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { getByRole, getByAltText } from '@testing-library/dom';
import Vuex from 'vuex'; import Vuex from 'vuex';
import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue'; import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue';
import createStore from 'ee/geo_replicable/store'; import createStore from 'ee/geo_replicable/store';
...@@ -21,7 +21,7 @@ describe('GeoReplicableEmptyState', () => { ...@@ -21,7 +21,7 @@ describe('GeoReplicableEmptyState', () => {
}; };
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(GeoReplicableEmptyState, { wrapper = mount(GeoReplicableEmptyState, {
localVue, localVue,
store: createStore({ replicableType: MOCK_REPLICABLE_TYPE, graphqlFieldName: null }), store: createStore({ replicableType: MOCK_REPLICABLE_TYPE, graphqlFieldName: null }),
propsData, propsData,
...@@ -30,23 +30,26 @@ describe('GeoReplicableEmptyState', () => { ...@@ -30,23 +30,26 @@ describe('GeoReplicableEmptyState', () => {
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
wrapper = null;
}); });
const findGlEmptyState = () => wrapper.find(GlEmptyState);
describe('template', () => { describe('template', () => {
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
}); });
describe('GlEmptyState', () => { it('renders correct link', () => {
it('renders always', () => { expect(
expect(findGlEmptyState().exists()).toBe(true); getByRole(wrapper.element, 'link', { name: 'Geo Troubleshooting' }).getAttribute('href'),
}); ).toBe(MOCK_GEO_TROUBLESHOOTING_LINK);
});
it('sets correct svg', () => { it('sets correct svg', () => {
expect(findGlEmptyState().attributes('svgpath')).toBe(MOCK_GEO_REPLICATION_SVG_PATH); expect(
}); getByAltText(wrapper.element, `There are no ${MOCK_REPLICABLE_TYPE} to show`).getAttribute(
'src',
),
).toBe(MOCK_GEO_REPLICATION_SVG_PATH);
}); });
}); });
}); });
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