Merge pull request #329 from Medical-Insight/fix-shift-chars

Fixes #326: correct handling of shift key
This commit is contained in:
Solly 2014-01-13 13:01:16 -08:00
commit 98c1275d80
2 changed files with 9 additions and 1 deletions

View File

@ -31,7 +31,7 @@ var kbdUtil = (function() {
function hasShortcutModifier(charModifier, currentModifiers) { function hasShortcutModifier(charModifier, currentModifiers) {
var mods = {}; var mods = {};
for (var key in currentModifiers) { for (var key in currentModifiers) {
if (key !== 0xffe1) { if (parseInt(key) !== 0xffe1) {
mods[key] = currentModifiers[key]; mods[key] = currentModifiers[key];
} }
} }

View File

@ -248,5 +248,13 @@ describe('Helpers', function() {
})).to.be.deep.equal([{keysym: keysyms.lookup(0xffe9), type: 'keydown'}]); })).to.be.deep.equal([{keysym: keysyms.lookup(0xffe9), type: 'keydown'}]);
}); });
}); });
describe('do not treat shift as a modifier key', function() {
it('should not treat shift as a shortcut modifier', function() {
expect(kbdUtil.hasShortcutModifier([], {0xffe1 : true})).to.be.false;
});
it('should not treat shift as a char modifier', function() {
expect(kbdUtil.hasCharModifier([], {0xffe1 : true})).to.be.false;
});
});
}); });
}); });