diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-24 18:11:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-24 18:11:33 +0300 |
commit | 87543246d9d68066b216811f3de590689e218e7c (patch) | |
tree | 72d72aea138b81fe5ccb3b575866906e2da9bcf8 /spec/frontend/badges/components/badge_list_spec.js | |
parent | 4d3bbc4990ead10831a087cece3ccdd25dc4f0b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/badges/components/badge_list_spec.js')
-rw-r--r-- | spec/frontend/badges/components/badge_list_spec.js | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/spec/frontend/badges/components/badge_list_spec.js b/spec/frontend/badges/components/badge_list_spec.js index 6cc90c6de46..39fa502b207 100644 --- a/spec/frontend/badges/components/badge_list_spec.js +++ b/spec/frontend/badges/components/badge_list_spec.js @@ -1,4 +1,4 @@ -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import { mountComponentWithStore } from 'helpers/vue_mount_component_helper'; import BadgeList from '~/badges/components/badge_list.vue'; import { GROUP_BADGE, PROJECT_BADGE } from '~/badges/constants'; @@ -48,46 +48,34 @@ describe('BadgeList component', () => { expect(rows).toHaveLength(numberOfDummyBadges); }); - it('renders a message if no badges exist', (done) => { + it('renders a message if no badges exist', async () => { store.state.badges = []; - Vue.nextTick() - .then(() => { - expect(vm.$el.innerText).toMatch('This project has no badges'); - }) - .then(done) - .catch(done.fail); + await nextTick(); + expect(vm.$el.innerText).toMatch('This project has no badges'); }); - it('shows a loading icon when loading', (done) => { + it('shows a loading icon when loading', async () => { store.state.isLoading = true; - Vue.nextTick() - .then(() => { - const loadingIcon = vm.$el.querySelector('.gl-spinner'); + await nextTick(); + const loadingIcon = vm.$el.querySelector('.gl-spinner'); - expect(loadingIcon).toBeVisible(); - }) - .then(done) - .catch(done.fail); + expect(loadingIcon).toBeVisible(); }); describe('for group badges', () => { - beforeEach((done) => { + beforeEach(async () => { store.state.kind = GROUP_BADGE; - Vue.nextTick().then(done).catch(done.fail); + await nextTick(); }); - it('renders a message if no badges exist', (done) => { + it('renders a message if no badges exist', async () => { store.state.badges = []; - Vue.nextTick() - .then(() => { - expect(vm.$el.innerText).toMatch('This group has no badges'); - }) - .then(done) - .catch(done.fail); + await nextTick(); + expect(vm.$el.innerText).toMatch('This group has no badges'); }); }); }); |