Skip to content

Commit

Permalink
Core: Fix {empty} keys inserting a colon
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Sep 30, 2016
1 parent e271835 commit f064b16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/jquery.keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ http://www.opensource.org/licenses/mit-license.php
} else {
// find key label
// corner case of '::;' reduced to ':;', split as ['', ';']
if (parts[0] === '') {
if (name !== '' && parts[0] === '') {
data.name = ':';
parts = parts.slice(1);
} else {
Expand Down
5 changes: 3 additions & 2 deletions testing/testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ jQuery(function($){
************************************************/
QUnit.test( 'processKeys', function(assert) {
var k = kb.processKeys;
assert.expect(15);
assert.expect(16);
assert.deepEqual( k(''), { name: '', map: '', title: ''}, 'Empty name');
assert.deepEqual( k('test'), { name: 'test', map: '', title: '' }, 'test');
assert.deepEqual( k('@:this_is_an_at_symbol'), { name: '@', map: '', title: 'this is an at symbol' }, '@:this_is_an_at_symbol');
assert.deepEqual( k(';(q)'), { name: ';', map: 'q', title: '' }, ';(q)');
Expand Down Expand Up @@ -222,4 +223,4 @@ jQuery(function($){
}
});

});
});

0 comments on commit f064b16

Please sign in to comment.