Fix broken specs

Fixes specs that got broken after some close buttons got converted from
plain button elements to GlButton components in GitLab UI.
parent 3678def3
import { GlAlert, GlTable, GlEmptyState, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui'; import {
GlAlert,
GlTable,
GlEmptyState,
GlIntersectionObserver,
GlLoadingIcon,
GlButton,
} from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import FirstClassGroupVulnerabilities from 'ee/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue'; import FirstClassGroupVulnerabilities from 'ee/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue';
import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue'; import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue';
...@@ -74,7 +81,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => { ...@@ -74,7 +81,7 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
it('should have an alert that is dismissable', () => { it('should have an alert that is dismissable', () => {
const alert = findAlert(); const alert = findAlert();
alert.find('button').trigger('click'); alert.find(GlButton).vm.$emit('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(alert.exists()).toBe(false); expect(alert.exists()).toBe(false);
}); });
......
import { GlAlert, GlTable, GlEmptyState, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui'; import {
GlAlert,
GlButton,
GlTable,
GlEmptyState,
GlIntersectionObserver,
GlLoadingIcon,
} from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import FirstClassInstanceVulnerabilities from 'ee/security_dashboard/components/first_class_instance_security_dashboard_vulnerabilities.vue'; import FirstClassInstanceVulnerabilities from 'ee/security_dashboard/components/first_class_instance_security_dashboard_vulnerabilities.vue';
...@@ -93,7 +100,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => { ...@@ -93,7 +100,7 @@ describe('First Class Instance Dashboard Vulnerabilities Component', () => {
it('should have an alert that is dismissable', () => { it('should have an alert that is dismissable', () => {
const alert = findAlert(); const alert = findAlert();
alert.find('button').trigger('click'); alert.find(GlButton).vm.$emit('click');
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(alert.exists()).toBe(false); expect(alert.exists()).toBe(false);
}); });
......
...@@ -6,10 +6,10 @@ exports[`NetworkPolicyList component renders policies table 1`] = ` ...@@ -6,10 +6,10 @@ exports[`NetworkPolicyList component renders policies table 1`] = `
<table <table
aria-busy="false" aria-busy="false"
aria-colcount="3" aria-colcount="3"
aria-describedby="__BVID__333__caption_" aria-describedby="__BVID__335__caption_"
aria-multiselectable="false" aria-multiselectable="false"
class="table b-table gl-table table-hover b-table-stacked-md b-table-selectable b-table-select-single" class="table b-table gl-table table-hover b-table-stacked-md b-table-selectable b-table-select-single"
id="__BVID__333" id="__BVID__335"
role="table" role="table"
> >
<!----> <!---->
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlBanner } from '@gitlab/ui'; import { GlBanner, GlButton } from '@gitlab/ui';
import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
import { setCookie, parseBoolean } from '~/lib/utils/common_utils'; import { setCookie, parseBoolean } from '~/lib/utils/common_utils';
import InviteMembersBanner from '~/groups/components/invite_members_banner.vue'; import InviteMembersBanner from '~/groups/components/invite_members_banner.vue';
...@@ -107,14 +107,12 @@ describe('InviteMembersBanner', () => { ...@@ -107,14 +107,12 @@ describe('InviteMembersBanner', () => {
}); });
describe('dismissing', () => { describe('dismissing', () => {
const findButton = () => { const findButton = () => wrapper.findAll(GlButton).at(1);
return wrapper.find('button');
};
beforeEach(() => { beforeEach(() => {
wrapper = createComponent({ GlBanner }); wrapper = createComponent({ GlBanner });
findButton().trigger('click'); findButton().vm.$emit('click');
}); });
it('sets iDismissed to true', () => { it('sets iDismissed to true', () => {
......
...@@ -19,7 +19,7 @@ describe('Submit Changes Error', () => { ...@@ -19,7 +19,7 @@ describe('Submit Changes Error', () => {
}); });
}; };
const findRetryButton = () => wrapper.find(GlButton); const findRetryButton = () => wrapper.findAll(GlButton).at(1);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
beforeEach(() => { beforeEach(() => {
......
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