Commit 52b06250 authored by Alexander Turinske's avatar Alexander Turinske

Separate new tests from old tests

- the new tests use vue/test-utils and it was confusing to
  mix those tests in with existing ones, so I separated them
  out into their own describe block
parent 931a2c62
......@@ -163,50 +163,60 @@ describe('Report section', () => {
.catch(done.fail);
});
it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', done => {
createComponent({ hasIssues: true, shouldEmitToggleEvent: true });
expect(wrapper.emitted().toggleEvent).toBeUndefined();
wrapper.vm.$el.querySelector('button').click();
return wrapper.vm
.$nextTick()
it('is always expanded, if always-open is set to true', done => {
vm.alwaysOpen = true;
Vue.nextTick()
.then(() => {
expect(wrapper.emitted().toggleEvent).toHaveLength(1);
expect(vm.$el.querySelector('.js-report-section-container')).not.toHaveCss(hiddenCss);
expect(vm.$el.querySelector('button')).toBeNull();
})
.then(done)
.catch(done.fail);
});
});
});
it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', done => {
createComponent({ hasIssues: true });
describe('snowplow events', () => {
it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', done => {
createComponent({ hasIssues: true, shouldEmitToggleEvent: true });
expect(wrapper.emitted().toggleEvent).toBeUndefined();
expect(wrapper.emitted().toggleEvent).toBeUndefined();
wrapper.vm.$el.querySelector('button').click();
return wrapper.vm
.$nextTick()
.then(() => {
expect(wrapper.emitted().toggleEvent).toBeUndefined();
})
.then(done)
.catch(done.fail);
});
wrapper.vm.$el.querySelector('button').click();
return wrapper.vm
.$nextTick()
.then(() => {
expect(wrapper.emitted().toggleEvent).toHaveLength(1);
})
.then(done)
.catch(done.fail);
});
it('is always expanded, if always-open is set to true', done => {
createComponent({ alwaysOpen: true, hasIssues: true, shouldEmitToggleEvent: true });
it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', done => {
createComponent({ hasIssues: true });
Vue.nextTick()
.then(() => {
expect(wrapper.vm.$el.querySelector('.js-report-section-container')).not.toHaveCss(
hiddenCss,
);
expect(wrapper.vm.$el.querySelector('button')).toBeNull();
expect(wrapper.emitted().toggleEvent).toBeUndefined();
})
.then(done)
.catch(done.fail);
});
expect(wrapper.emitted().toggleEvent).toBeUndefined();
wrapper.vm.$el.querySelector('button').click();
return wrapper.vm
.$nextTick()
.then(() => {
expect(wrapper.emitted().toggleEvent).toBeUndefined();
})
.then(done)
.catch(done.fail);
});
it('does not emit an event if always-open is set to true', done => {
createComponent({ alwaysOpen: true, hasIssues: true, shouldEmitToggleEvent: true });
wrapper.vm
.$nextTick()
.then(() => {
expect(wrapper.emitted().toggleEvent).toBeUndefined();
})
.then(done)
.catch(done.fail);
});
});
......
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