Commit af3dd043 authored by Dennis Tang's avatar Dennis Tang

clean up component tests

parent 918077a0
...@@ -84,10 +84,10 @@ describe('GkeMachineTypeDropdown', () => { ...@@ -84,10 +84,10 @@ describe('GkeMachineTypeDropdown', () => {
expect(vm.$el.querySelector('input').value).toBe(''); expect(vm.$el.querySelector('input').value).toBe('');
vm.$store.commit(SET_MACHINE_TYPES, gapiMachineTypesResponseMock.items); vm.$store.commit(SET_MACHINE_TYPES, gapiMachineTypesResponseMock.items);
vm.$nextTick(() => { return vm.$nextTick().then(() => {
vm.$el.querySelector('.dropdown-content button').click(); vm.$el.querySelector('.dropdown-content button').click();
vm.$nextTick(() => { return vm.$nextTick().then(() => {
expect(vm.$el.querySelector('input').value).toBe(selectedMachineTypeMock); expect(vm.$el.querySelector('input').value).toBe(selectedMachineTypeMock);
done(); done();
}); });
......
...@@ -43,34 +43,28 @@ describe('GkeProjectIdDropdown', () => { ...@@ -43,34 +43,28 @@ describe('GkeProjectIdDropdown', () => {
}); });
it('returns default toggle text', done => { it('returns default toggle text', done => {
vm.$nextTick(() => { return vm.$nextTick().then(() => {
vm.$nextTick(() => { vm.setItem(emptyProjectMock);
vm.setItem(emptyProjectMock);
expect(vm.toggleText).toBe(LABELS.DEFAULT); expect(vm.toggleText).toBe(LABELS.DEFAULT);
done(); done();
});
}); });
}); });
it('returns project name if project selected', done => { it('returns project name if project selected', done => {
vm.$nextTick(() => { return vm.$nextTick().then(() => {
vm.$nextTick(() => { expect(vm.toggleText).toBe(selectedProjectMock.name);
expect(vm.toggleText).toBe(selectedProjectMock.name); done();
done();
});
}); });
}); });
it('returns empty toggle text', done => { it('returns empty toggle text', done => {
vm.$nextTick(() => { return vm.$nextTick().then(() => {
vm.$store.commit(SET_PROJECTS, []); vm.$store.commit(SET_PROJECTS, []);
vm.setItem(emptyProjectMock); vm.setItem(emptyProjectMock);
vm.$nextTick(() => { expect(vm.toggleText).toBe(LABELS.EMPTY);
expect(vm.toggleText).toBe(LABELS.EMPTY); done();
done();
});
}); });
}); });
}); });
...@@ -79,13 +73,12 @@ describe('GkeProjectIdDropdown', () => { ...@@ -79,13 +73,12 @@ describe('GkeProjectIdDropdown', () => {
it('reflects new value when dropdown item is clicked', done => { it('reflects new value when dropdown item is clicked', done => {
expect(vm.$el.querySelector('input').value).toBe(''); expect(vm.$el.querySelector('input').value).toBe('');
vm.$nextTick(() => { return vm.$nextTick().then(() => {
vm.$nextTick(() => { vm.$el.querySelector('.dropdown-content button').click();
vm.$el.querySelector('.dropdown-content button').click();
vm.$nextTick(() => { return vm.$nextTick().then(() => {
expect(vm.$el.querySelector('input').value).toBe(selectedProjectMock.projectId); expect(vm.$el.querySelector('input').value).toBe(selectedProjectMock.projectId);
done(); done();
});
}); });
}); });
}); });
......
...@@ -66,10 +66,10 @@ describe('GkeZoneDropdown', () => { ...@@ -66,10 +66,10 @@ describe('GkeZoneDropdown', () => {
expect(vm.$el.querySelector('input').value).toBe(''); expect(vm.$el.querySelector('input').value).toBe('');
vm.$store.commit(SET_ZONES, gapiZonesResponseMock.items); vm.$store.commit(SET_ZONES, gapiZonesResponseMock.items);
vm.$nextTick(() => { return vm.$nextTick().then(() => {
vm.$el.querySelector('.dropdown-content button').click(); vm.$el.querySelector('.dropdown-content button').click();
vm.$nextTick(() => { return vm.$nextTick().then(() => {
expect(vm.$el.querySelector('input').value).toBe(selectedZoneMock); expect(vm.$el.querySelector('input').value).toBe(selectedZoneMock);
done(); done();
}); });
......
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