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>
import { mapGetters } from 'vuex';
import { GlEmptyState } from '@gitlab/ui';
import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
export default {
name: 'GeoReplicableEmptyState',
components: {
GlEmptyState,
GlSprintf,
GlLink,
},
props: {
geoReplicableEmptySvgPath: {
......
---
title: Geo Replicables - Fix missing help text
merge_request: 48378
author:
type: fixed
import { GlEmptyState } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { createLocalVue, mount } from '@vue/test-utils';
import { getByRole, getByAltText } from '@testing-library/dom';
import Vuex from 'vuex';
import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue';
import createStore from 'ee/geo_replicable/store';
......@@ -21,7 +21,7 @@ describe('GeoReplicableEmptyState', () => {
};
const createComponent = () => {
wrapper = shallowMount(GeoReplicableEmptyState, {
wrapper = mount(GeoReplicableEmptyState, {
localVue,
store: createStore({ replicableType: MOCK_REPLICABLE_TYPE, graphqlFieldName: null }),
propsData,
......@@ -30,23 +30,26 @@ describe('GeoReplicableEmptyState', () => {
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
const findGlEmptyState = () => wrapper.find(GlEmptyState);
describe('template', () => {
beforeEach(() => {
createComponent();
});
describe('GlEmptyState', () => {
it('renders always', () => {
expect(findGlEmptyState().exists()).toBe(true);
it('renders correct link', () => {
expect(
getByRole(wrapper.element, 'link', { name: 'Geo Troubleshooting' }).getAttribute('href'),
).toBe(MOCK_GEO_TROUBLESHOOTING_LINK);
});
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