Commit ebc7b2f3 authored by Clement Ho's avatar Clement Ho

Fix karma specs

parent 13881488
...@@ -27,11 +27,11 @@ describe('issueItem', () => { ...@@ -27,11 +27,11 @@ describe('issueItem', () => {
}); });
it('does not render token state', () => { it('does not render token state', () => {
expect(vm.$el.querySelector('.text-secondary i')).toBeNull(); expect(vm.$el.querySelector('.text-secondary svg')).toBeNull();
}); });
it('does not render remove button', () => { it('does not render remove button', () => {
expect(vm.$el.querySelector('.js-issue-token-remove-button')).toBeNull(); expect(vm.$refs.removeButton).toBeUndefined();
}); });
describe('token title', () => { describe('token title', () => {
...@@ -50,13 +50,13 @@ describe('issueItem', () => { ...@@ -50,13 +50,13 @@ describe('issueItem', () => {
beforeEach((done) => { beforeEach((done) => {
vm.state = 'opened'; vm.state = 'opened';
Vue.nextTick(() => { Vue.nextTick(() => {
tokenState = vm.$el.querySelector('.text-secondary i'); tokenState = vm.$el.querySelector('.text-secondary svg');
done(); done();
}); });
}); });
it('renders if hasState', () => { it('renders if hasState', () => {
expect(tokenState).not.toBeNull(); expect(tokenState).toBeDefined();
}); });
it('renders state title', () => { it('renders state title', () => {
...@@ -68,14 +68,14 @@ describe('issueItem', () => { ...@@ -68,14 +68,14 @@ describe('issueItem', () => {
}); });
it('renders open icon when open state', () => { it('renders open icon when open state', () => {
expect(tokenState.classList.contains('fa-circle-o')).toEqual(true); expect(tokenState.classList.contains('issue-token-state-icon-open')).toEqual(true);
}); });
it('renders close icon when close state', (done) => { it('renders close icon when close state', (done) => {
vm.state = 'closed'; vm.state = 'closed';
Vue.nextTick(() => { Vue.nextTick(() => {
expect(tokenState.classList.contains('fa-minus')).toEqual(true); expect(tokenState.classList.contains('issue-token-state-icon-closed')).toEqual(true);
done(); done();
}); });
}); });
...@@ -87,13 +87,13 @@ describe('issueItem', () => { ...@@ -87,13 +87,13 @@ describe('issueItem', () => {
beforeEach((done) => { beforeEach((done) => {
vm.canRemove = true; vm.canRemove = true;
Vue.nextTick(() => { Vue.nextTick(() => {
removeBtn = vm.$el.querySelector('.js-issue-token-remove-button'); removeBtn = vm.$refs.removeButton;
done(); done();
}); });
}); });
it('renders if canRemove', () => { it('renders if canRemove', () => {
expect(removeBtn).not.toBeNull(); expect(removeBtn).toBeDefined();
}); });
it('renders disabled button when removeDisabled', (done) => { it('renders disabled button when removeDisabled', (done) => {
......
...@@ -138,7 +138,8 @@ describe('IssueToken', () => { ...@@ -138,7 +138,8 @@ describe('IssueToken', () => {
}); });
it('shows reference, title, and state', () => { it('shows reference, title, and state', () => {
expect(vm.$refs.stateIcon.getAttribute('aria-label')).toEqual(state); const stateIcon = vm.$refs.reference.querySelector('svg');
expect(stateIcon.getAttribute('aria-label')).toEqual(state);
expect(vm.$refs.reference.textContent.trim()).toEqual(displayReference); expect(vm.$refs.reference.textContent.trim()).toEqual(displayReference);
expect(vm.$refs.title.textContent.trim()).toEqual(title); expect(vm.$refs.title.textContent.trim()).toEqual(title);
}); });
......
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