import { expect } from "chai";
import * as navigates from '../../src/content/navigates';
describe('navigates module', () => {
beforeEach(() => {
});
describe('#linkPrev', () => {
it('clicks prev link by text content', (done) => {
document.body.innerHTML = 'xprevx go to prev';
navigates.linkPrev(window);
setTimeout(() => {
expect(document.location.hash).to.equal('#prev');
done();
}, 0);
});
it('clicks a[rel=prev] element preferentially', (done) => {
document.body.innerHTML = 'prev rel';
navigates.linkPrev(window);
setTimeout(() => {
expect(document.location.hash).to.equal('#prev');
done();
}, 0);
});
});
describe('#linkNext', () => {
it('clicks next link by text content', (done) => {
document.body.innerHTML = 'xnextx go to next';
navigates.linkNext(window);
setTimeout(() => {
expect(document.location.hash).to.equal('#next');
done();
}, 0);
});
it('clicks a[rel=next] element preferentially', (done) => {
document.body.innerHTML = 'next rel';
navigates.linkNext(window);
setTimeout(() => {
expect(document.location.hash).to.equal('#next');
done();
}, 0);
});
});
});