Commit 5c6aaee2 authored by Simon Knox's avatar Simon Knox

local queryselector for specs

parent fe0e0b73
......@@ -61,7 +61,7 @@ describe('Assignee select component', () => {
it('hides Edit button', (done) => {
vm.canEdit = false;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeFalsy();
expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
done();
});
});
......@@ -69,7 +69,7 @@ describe('Assignee select component', () => {
it('shows Edit button if true', (done) => {
vm.canEdit = true;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeTruthy();
expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
done();
});
});
......
......@@ -67,7 +67,7 @@ describe('LabelsSelect', () => {
it('hides Edit button', (done) => {
vm.canEdit = false;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeFalsy();
expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
done();
});
});
......@@ -75,7 +75,7 @@ describe('LabelsSelect', () => {
it('shows Edit button if true', (done) => {
vm.canEdit = true;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeTruthy();
expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
done();
});
});
......@@ -107,10 +107,10 @@ describe('LabelsSelect', () => {
describe('clicking dropdown items', () => {
it('sets No labels', (done) => {
vm.board.labels = [label];
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
document.querySelectorAll('li a')[0].click();
vm.$el.querySelectorAll('li a')[0].click();
});
setTimeout(() => {
......@@ -121,10 +121,10 @@ describe('LabelsSelect', () => {
});
it('sets value', (done) => {
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
document.querySelectorAll('li a')[1].click();
vm.$el.querySelectorAll('li a')[1].click();
});
setTimeout(() => {
......
......@@ -72,7 +72,7 @@ describe('WeightSelect', () => {
describe('active item in dropdown', () => {
it('defaults to Any Weight', (done) => {
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
expect(activeDropdownItem()).toEqual('Any Weight');
......@@ -82,7 +82,7 @@ describe('WeightSelect', () => {
it('shows No Weight', (done) => {
vm.value = 0;
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
expect(activeDropdownItem()).toEqual('No Weight');
......@@ -92,7 +92,7 @@ describe('WeightSelect', () => {
it('shows correct weight', (done) => {
vm.value = 1;
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
expect(activeDropdownItem()).toEqual('1');
......@@ -103,10 +103,10 @@ describe('WeightSelect', () => {
describe('changing weight', () => {
it('sets value', (done) => {
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
document.querySelectorAll('li a')[3].click();
vm.$el.querySelectorAll('li a')[3].click();
});
setTimeout(() => {
......@@ -118,10 +118,10 @@ describe('WeightSelect', () => {
it('sets Any Weight', (done) => {
vm.value = 2;
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
document.querySelectorAll('li a')[0].click();
vm.$el.querySelectorAll('li a')[0].click();
});
setTimeout(() => {
......@@ -133,10 +133,10 @@ describe('WeightSelect', () => {
it('sets No Weight', (done) => {
vm.value = 2;
document.querySelector('.edit-link').click();
vm.$el.querySelector('.edit-link').click();
setTimeout(() => {
document.querySelectorAll('li a')[1].click();
vm.$el.querySelectorAll('li a')[1].click();
});
setTimeout(() => {
......
......@@ -15,7 +15,7 @@ function selectedText() {
}
function activeDropdownItem(index) {
const items = document.querySelectorAll('.is-active');
const items = vm.$el.querySelectorAll('.is-active');
if (!items[index]) return '';
return items[index].innerText.trim();
}
......@@ -55,7 +55,7 @@ describe('Milestone select component', () => {
it('hides Edit button', (done) => {
vm.canEdit = false;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeFalsy();
expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
done();
});
});
......@@ -63,7 +63,7 @@ describe('Milestone select component', () => {
it('shows Edit button if true', (done) => {
vm.canEdit = true;
Vue.nextTick(() => {
expect(document.querySelector('.edit-link')).toBeTruthy();
expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
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