Commit 822b1b3b authored by Phil Hughes's avatar Phil Hughes

fixed karma specs with change to axios instead of $.ajax

parent 6a7527c9
/* global BoardService */
import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import '~/labels_select';
import LabelsSelect from '~/boards/components/labels_select.vue';
import IssuableContext from '~/issuable_context';
......@@ -32,14 +34,16 @@ const label2 = {
};
describe('LabelsSelect', () => {
let mock;
beforeEach((done) => {
setFixtures('<div class="test-container"></div>');
const deferred = new jQuery.Deferred();
spyOn($, 'ajax').and.returnValue(deferred.resolve([
mock = new MockAdapter(axios);
mock.onGet('/some/path').reply(200, [
label,
label2,
]));
]);
// eslint-disable-next-line no-new
new IssuableContext();
......@@ -60,6 +64,10 @@ describe('LabelsSelect', () => {
Vue.nextTick(done);
});
afterEach(() => {
mock.restore();
});
describe('canEdit', () => {
it('hides Edit button', (done) => {
vm.canEdit = false;
......
/* global BoardService */
import Vue from 'vue';
import MockAdapater from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import MilestoneSelect from '~/boards/components/milestone_select.vue';
import IssuableContext from '~/issuable_context';
import { boardObj } from './mock_data';
......@@ -92,12 +94,18 @@ describe('Milestone select component', () => {
});
describe('clicking dropdown items', () => {
let mock;
beforeEach(() => {
const deferred = new jQuery.Deferred();
spyOn($, 'ajax').and.returnValue(deferred.resolve([
mock = new MockAdapater(axios);
mock.onGet('/test/issue-boards/milestones.json').reply(200, [
milestone,
milestone2,
]));
]);
});
afterEach(() => {
mock.restore();
});
it('sets Any Milestone', (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