Last active
September 18, 2017 18:49
-
-
Save bmfteixeira/21c25b61cd21aabec3d51166c9e54bbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Basic component', () => { | |
describe('Lifecycle', () => { | |
it('Mounted', done => { | |
const handleScrollStub = sinon.stub(BasicComponent.methods, 'handleScroll') | |
const addEventStub = sinon.stub(window, 'addEventListener') | |
const wrapper = mount(BasicComponent) | |
expect(addEventStub).to.be.calledWith('scroll', wrapper.vm.handleScroll) | |
handleScrollStub.restore() | |
addEventStub.restore() | |
done() | |
}) | |
it('Destroyed', done => { | |
const wrapper = mount(BasicComponent) | |
const handleScrollStub = sinon.stub(wrapper.vm, 'handleScroll') | |
const removeEventStub = sinon.stub(window, 'removeEventListener') | |
wrapper.destroy() | |
expect(removeEventStub).to.be.calledWith('scroll', wrapper.vm.handleScroll) | |
handleScrollStub.restore() | |
removeEventStub.restore() | |
done() | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment