Commit 4f189ecd authored by Robert Knight's avatar Robert Knight

Add tests for Guest#destroy

parent 3b11445b
...@@ -948,4 +948,34 @@ describe('Guest', () => { ...@@ -948,4 +948,34 @@ describe('Guest', () => {
assert.calledWith(removeHighlights, highlights); assert.calledWith(removeHighlights, highlights);
}); });
}); });
describe('#destroy', () => {
it('disconnects from sidebar events', () => {
const guest = createGuest();
guest.destroy();
assert.calledOnce(fakeCrossFrame.destroy);
});
it('removes the adder toolbar', () => {
const guest = createGuest();
const adder = guest.element.querySelector('hypothesis-adder');
assert.equal(adder.parentElement, guest.element);
guest.destroy();
assert.isNull(adder.parentElement);
});
it('cleans up PDF integration', () => {
const guest = createGuest({ documentType: 'pdf' });
guest.destroy();
assert.calledOnce(fakePdfIntegration.destroy);
});
it('removes all highlights', () => {
const guest = createGuest();
guest.destroy();
assert.calledWith(highlighter.removeAllHighlights, guest.element);
});
});
}); });
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