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', () => { ...@@ -163,50 +163,60 @@ describe('Report section', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does emit an event on issue toggle if the shouldEmitToggleEvent prop does exist', done => { it('is always expanded, if always-open is set to true', done => {
createComponent({ hasIssues: true, shouldEmitToggleEvent: true }); vm.alwaysOpen = true;
Vue.nextTick()
expect(wrapper.emitted().toggleEvent).toBeUndefined();
wrapper.vm.$el.querySelector('button').click();
return wrapper.vm
.$nextTick()
.then(() => { .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) .then(done)
.catch(done.fail); .catch(done.fail);
}); });
});
});
it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', done => { describe('snowplow events', () => {
createComponent({ hasIssues: true }); 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(); wrapper.vm.$el.querySelector('button').click();
return wrapper.vm return wrapper.vm
.$nextTick() .$nextTick()
.then(() => { .then(() => {
expect(wrapper.emitted().toggleEvent).toBeUndefined(); expect(wrapper.emitted().toggleEvent).toHaveLength(1);
}) })
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
}); });
it('is always expanded, if always-open is set to true', done => { it('does not emit an event on issue toggle if the shouldEmitToggleEvent prop does not exist', done => {
createComponent({ alwaysOpen: true, hasIssues: true, shouldEmitToggleEvent: true }); createComponent({ hasIssues: true });
Vue.nextTick() expect(wrapper.emitted().toggleEvent).toBeUndefined();
.then(() => {
expect(wrapper.vm.$el.querySelector('.js-report-section-container')).not.toHaveCss( wrapper.vm.$el.querySelector('button').click();
hiddenCss, return wrapper.vm
); .$nextTick()
expect(wrapper.vm.$el.querySelector('button')).toBeNull(); .then(() => {
expect(wrapper.emitted().toggleEvent).toBeUndefined(); expect(wrapper.emitted().toggleEvent).toBeUndefined();
}) })
.then(done) .then(done)
.catch(done.fail); .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