From e9ddbec5b1ae69d0cc24dc97f54fdd55cc10b3c7 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Thu, 10 Nov 2016 11:57:45 +0100 Subject: [PATCH] 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. --- tests/test.helper.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test.helper.js b/tests/test.helper.js index 0c68b167..2adba9b2 100644 --- a/tests/test.helper.js +++ b/tests/test.helper.js @@ -40,7 +40,10 @@ describe('Helpers', function() { }); it('should map unknown codepoints to the Unicode range', function() { 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); }); });