Fix keysyms.fromUnicode() tests

Node.js doesn't handle characters high up in the unicode range
properly with charCodeAt(). Adding a new test for UCS-4 codepoints
using codePointAt() to cover this.
This commit is contained in:
Samuel Mannehed 2016-11-10 11:57:45 +01:00
parent a0ab4d4b34
commit e9ddbec5b1
1 changed files with 4 additions and 1 deletions

View File

@ -40,7 +40,10 @@ describe('Helpers', function() {
}); });
it('should map unknown codepoints to the Unicode range', function() { it('should map unknown codepoints to the Unicode range', function() {
expect(keysyms.fromUnicode('\n'.charCodeAt())).to.have.property('keysym', 0x100000a); expect(keysyms.fromUnicode('\n'.charCodeAt())).to.have.property('keysym', 0x100000a);
expect(keysyms.fromUnicode('\u{1F686}'.charCodeAt())).to.have.property('keysym', 0x101f686); expect(keysyms.fromUnicode('\u262D'.charCodeAt())).to.have.property('keysym', 0x100262d);
});
it('should map UCS-4 codepoints to the Unicode range', function() {
expect(keysyms.fromUnicode('\u{1F686}'.codePointAt())).to.have.property('keysym', 0x101f686);
}); });
}); });