Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding test for only setting CSS once
  • Loading branch information
Lindsay Evans committed Sep 29, 2018
1 parent e9c6d52 commit 0c5efc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/remove-focus-outline.test.ts
Expand Up @@ -102,7 +102,12 @@ describe('The library should...', () => {

})

// TODO:
// * configuration merges correctly
test('only set CSS once for multiple of same event', () => {
setCssSpy.mockClear()
triggerEvent('mousedown')
triggerEvent('mousedown')

expect(setCssSpy).toHaveReturnedWith(false)
})

})
5 changes: 4 additions & 1 deletion src/remove-focus-outline.ts
Expand Up @@ -78,7 +78,7 @@ export class RemoveFocusOutline {
/**
* Sets the CSS
*/
private setCss(css: string) {
private setCss(css: string): boolean {

if (css !== this.currentCss) {
this.currentCss = css;
Expand All @@ -89,6 +89,9 @@ export class RemoveFocusOutline {
} else {
this.$style.innerHTML = css;
}
return true;
} else {
return false;
}
}

Expand Down

0 comments on commit 0c5efc6

Please sign in to comment.