mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-27 02:12:24 +02:00
Ignore Ctrl and Alt if both are present (e.g. AltGr on Windows)
(see #4096)
This commit is contained in:
@@ -38,6 +38,30 @@ describe('d3.keybinding', function() {
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('matches the binding even when shift is present', function () {
|
||||
d3.select(document).call(keybinding.on('A', spy));
|
||||
|
||||
happen.keydown(document, {keyCode: 65, shiftKey: true});
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('matches shifted bindings before unshifted bindings', function () {
|
||||
var spy2 = sinon.spy();
|
||||
d3.select(document).call(keybinding.on('A', spy2));
|
||||
d3.select(document).call(keybinding.on('⇧A', spy));
|
||||
|
||||
happen.keydown(document, {keyCode: 65, shiftKey: true});
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
expect(spy2).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('ignores alt and control if both are present (e.g. as AltGr) #4096', function () {
|
||||
d3.select(document).call(keybinding.on('A', spy));
|
||||
|
||||
happen.keydown(document, {keyCode: 65, altKey: true, ctrlKey: true});
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
it('adds multiple bindings given an array of keys', function () {
|
||||
d3.select(document).call(keybinding.on(['A','B'], spy));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user