Commit 04dc4bfc authored by Phil Hughes's avatar Phil Hughes

fixed assignee_select_spec.js

parent 6b827a5c
/* global BoardService */ /* global BoardService */
import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue'; import Vue from 'vue';
import axios from '~/lib/utils/axios_utils';
import AssigneeSelect from '~/boards/components/assignee_select.vue'; import AssigneeSelect from '~/boards/components/assignee_select.vue';
import '~/boards/services/board_service'; import '~/boards/services/board_service';
import '~/boards/stores/boards_store'; import '~/boards/stores/boards_store';
...@@ -86,12 +87,18 @@ describe('Assignee select component', () => { ...@@ -86,12 +87,18 @@ describe('Assignee select component', () => {
}); });
describe('clicking dropdown items', () => { describe('clicking dropdown items', () => {
let mock;
beforeEach(() => { beforeEach(() => {
const deferred = new jQuery.Deferred(); mock = new MockAdapter(axios);
spyOn($, 'ajax').and.returnValue(deferred.resolve([ mock.onGet('/autocomplete/users.json').reply(200, [
assignee, assignee,
assignee2, assignee2,
])); ]);
});
afterEach(() => {
mock.restore();
}); });
it('sets assignee', (done) => { it('sets assignee', (done) => {
...@@ -99,12 +106,12 @@ describe('Assignee select component', () => { ...@@ -99,12 +106,12 @@ describe('Assignee select component', () => {
setTimeout(() => { setTimeout(() => {
vm.$el.querySelectorAll('li a')[2].click(); vm.$el.querySelectorAll('li a')[2].click();
});
setTimeout(() => { setTimeout(() => {
expect(activeDropdownItem(0)).toEqual('second assignee'); expect(activeDropdownItem(0)).toEqual('second assignee');
expect(vm.board.assignee).toEqual(assignee2); expect(vm.board.assignee).toEqual(assignee2);
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