This repository has been archived on 2020-04-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Vim-Vixen/test/components/follow.test.js
2017-10-02 21:38:23 +09:00

25 lines
798 B
JavaScript

import { expect } from "chai";
import FollowComponent from '../../src/components/follow';
describe('FollowComponent', () => {
describe('#codeChars', () => {
it('returns a string for key codes', () => {
let chars = [
KeyboardEvent.DOM_VK_0, KeyboardEvent.DOM_VK_1,
KeyboardEvent.DOM_VK_A, KeyboardEvent.DOM_VK_B];
expect(FollowComponent.codeChars(chars)).to.equal('01ab');
expect(FollowComponent.codeChars([])).to.be.equal('');
});
});
describe('#getTargetElements', () => {
beforeEach(() => {
document.body.innerHTML = __html__['test/components/follow.html'];
});
it('returns visible links', () => {
let links = FollowComponent.getTargetElements(window.document);
expect(links).to.have.lengthOf(1);
});
});
});