diff options
Diffstat (limited to 'test/shared/settings/Key.test.ts')
-rw-r--r-- | test/shared/settings/Key.test.ts | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/test/shared/settings/Key.test.ts b/test/shared/settings/Key.test.ts index 8222d5a..91a47f8 100644 --- a/test/shared/settings/Key.test.ts +++ b/test/shared/settings/Key.test.ts @@ -76,17 +76,30 @@ describe("Key", () => { }); }); + describe('idDigit', () => { + it('returns true if the key is a digit', () => { + expect(new Key({ key: '0' }).isDigit()).to.be.true; + expect(new Key({ key: '9' }).isDigit()).to.be.true; + expect(new Key({ key: '9', shift: true }).isDigit()).to.be.true; + + expect(new Key({ key: 'a' }).isDigit()).to.be.false; + expect(new Key({ key: '0' }).isDigit()).to.be.false; + }) + }); + describe('equals', () => { - expect(new Key({ - key: 'x', shift: false, ctrl: true, alt: false, meta: false, - }).equals(new Key({ - key: 'x', shift: false, ctrl: true, alt: false, meta: false, - }))).to.be.true; + it('returns true if the keys are equivalent', () => { + expect(new Key({ + key: 'x', shift: false, ctrl: true, alt: false, meta: false, + }).equals(new Key({ + key: 'x', shift: false, ctrl: true, alt: false, meta: false, + }))).to.be.true; - expect(new Key({ - key: 'x', shift: false, ctrl: false, alt: false, meta: false, - }).equals(new Key({ - key: 'X', shift: true, ctrl: false, alt: false, meta: false, - }))).to.be.false; + expect(new Key({ + key: 'x', shift: false, ctrl: false, alt: false, meta: false, + }).equals(new Key({ + key: 'X', shift: true, ctrl: false, alt: false, meta: false, + }))).to.be.false; + }) }); }); |