Commit af3dd043 authored by Dennis Tang's avatar Dennis Tang

clean up component tests

parent 918077a0
......@@ -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();
});
......
......@@ -43,51 +43,44 @@ describe('GkeProjectIdDropdown', () => {
});
it('returns default toggle text', done => {
vm.$nextTick(() => {
vm.$nextTick(() => {
return vm.$nextTick().then(() => {
vm.setItem(emptyProjectMock);
expect(vm.toggleText).toBe(LABELS.DEFAULT);
done();
});
});
});
it('returns project name if project selected', done => {
vm.$nextTick(() => {
vm.$nextTick(() => {
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();
});
});
});
});
describe('selectItem', () => {
it('reflects new value when dropdown item is clicked', done => {
expect(vm.$el.querySelector('input').value).toBe('');
vm.$nextTick(() => {
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(selectedProjectMock.projectId);
done();
});
});
});
});
});
});
......@@ -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();
});
......
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