add Hint tests

This commit is contained in:
Shin'ya Ueoka 2017-08-21 22:19:01 +09:00
parent c50f463bc1
commit a052ec92b7
3 changed files with 64 additions and 2 deletions

View file

@ -2,6 +2,10 @@ import './hint.css';
export default class Hint {
constructor(target, tag) {
if (!(document.body instanceof HTMLElement)) {
throw new TypeError('target is not an HTMLElement');
}
this.target = target;
let doc = target.ownerDocument
@ -31,8 +35,7 @@ export default class Hint {
activate() {
if (this.target.tagName.toLowerCase() === 'a') {
let href = this.target.href;
window.location.href = href;
this.target.click();
}
}
}