diff options
author | Dennis Tang <dtang@gitlab.com> | 2018-05-11 10:20:48 +0200 |
---|---|---|
committer | Dennis Tang <dtang@gitlab.com> | 2018-05-11 10:20:48 +0200 |
commit | af3dd043610b9869183fb6238251b17e95ee922e (patch) | |
tree | 70d6d26ef17a9aa30e6e6d47b6ee22cb046a05cd /spec/javascripts/projects | |
parent | 918077a0b6b134df57ab6b518b4b6b63c14a5e5c (diff) | |
download | gitlab-ce-af3dd043610b9869183fb6238251b17e95ee922e.tar.gz |
clean up component tests
Diffstat (limited to 'spec/javascripts/projects')
3 files changed, 20 insertions, 27 deletions
diff --git a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown_spec.js b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown_spec.js index fe1aff2bd09..b6c1c454b2b 100644 --- a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown_spec.js +++ b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_machine_type_dropdown_spec.js @@ -84,10 +84,10 @@ describe('GkeMachineTypeDropdown', () => { expect(vm.$el.querySelector('input').value).toBe(''); vm.$store.commit(SET_MACHINE_TYPES, gapiMachineTypesResponseMock.items); - vm.$nextTick(() => { + return vm.$nextTick().then(() => { vm.$el.querySelector('.dropdown-content button').click(); - vm.$nextTick(() => { + return vm.$nextTick().then(() => { expect(vm.$el.querySelector('input').value).toBe(selectedMachineTypeMock); done(); }); diff --git a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js index d88c55216dd..1c322262a73 100644 --- a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js +++ b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_project_id_dropdown_spec.js @@ -43,34 +43,28 @@ describe('GkeProjectIdDropdown', () => { }); it('returns default toggle text', done => { - vm.$nextTick(() => { - vm.$nextTick(() => { - vm.setItem(emptyProjectMock); + return vm.$nextTick().then(() => { + vm.setItem(emptyProjectMock); - expect(vm.toggleText).toBe(LABELS.DEFAULT); - done(); - }); + expect(vm.toggleText).toBe(LABELS.DEFAULT); + done(); }); }); it('returns project name if project selected', done => { - vm.$nextTick(() => { - vm.$nextTick(() => { - expect(vm.toggleText).toBe(selectedProjectMock.name); - done(); - }); + return vm.$nextTick().then(() => { + expect(vm.toggleText).toBe(selectedProjectMock.name); + done(); }); }); it('returns empty toggle text', done => { - vm.$nextTick(() => { + return vm.$nextTick().then(() => { vm.$store.commit(SET_PROJECTS, []); vm.setItem(emptyProjectMock); - vm.$nextTick(() => { - expect(vm.toggleText).toBe(LABELS.EMPTY); - done(); - }); + expect(vm.toggleText).toBe(LABELS.EMPTY); + done(); }); }); }); @@ -79,13 +73,12 @@ describe('GkeProjectIdDropdown', () => { it('reflects new value when dropdown item is clicked', done => { expect(vm.$el.querySelector('input').value).toBe(''); - vm.$nextTick(() => { - vm.$nextTick(() => { - vm.$el.querySelector('.dropdown-content button').click(); - vm.$nextTick(() => { - expect(vm.$el.querySelector('input').value).toBe(selectedProjectMock.projectId); - done(); - }); + return vm.$nextTick().then(() => { + vm.$el.querySelector('.dropdown-content button').click(); + + return vm.$nextTick().then(() => { + expect(vm.$el.querySelector('input').value).toBe(selectedProjectMock.projectId); + done(); }); }); }); diff --git a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js index b8b06a06be0..c99816cd13c 100644 --- a/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js +++ b/spec/javascripts/projects/gke_cluster_dropdowns/components/gke_zone_dropdown_spec.js @@ -66,10 +66,10 @@ describe('GkeZoneDropdown', () => { expect(vm.$el.querySelector('input').value).toBe(''); vm.$store.commit(SET_ZONES, gapiZonesResponseMock.items); - vm.$nextTick(() => { + return vm.$nextTick().then(() => { vm.$el.querySelector('.dropdown-content button').click(); - vm.$nextTick(() => { + return vm.$nextTick().then(() => { expect(vm.$el.querySelector('input').value).toBe(selectedZoneMock); done(); }); |