Index: lib/src/iron-a11y-keys-behavior/test/basic-test.html |
diff --git a/lib/src/iron-a11y-keys-behavior/test/basic-test.html b/lib/src/iron-a11y-keys-behavior/test/basic-test.html |
index 8e50c92b4091a203acb5a71e1a0fc325283c8e48..fea60b6841c1eff90f7dd62b5925071431c6ab43 100644 |
--- a/lib/src/iron-a11y-keys-behavior/test/basic-test.html |
+++ b/lib/src/iron-a11y-keys-behavior/test/basic-test.html |
@@ -30,6 +30,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
</template> |
</test-fixture> |
+ <test-fixture id="NonPropagatingKeys"> |
+ <template> |
+ <x-a11y-basic-keys stop-keyboard-event-propagation></x-a11y-basic-keys> |
+ </template> |
+ </test-fixture> |
+ |
<test-fixture id="ComboKeys"> |
<template> |
<x-a11y-combo-keys></x-a11y-combo-keys> |
@@ -161,6 +167,15 @@ suite('Polymer.IronA11yKeysBehavior', function() { |
expect(keys.keyCount).to.be.equal(1); |
}); |
+ test('allows propagation beyond the key combo handler', function() { |
+ var keySpy = sinon.spy(); |
+ document.addEventListener('keydown', keySpy); |
+ |
+ MockInteractions.pressEnter(keys); |
+ |
+ expect(keySpy.callCount).to.be.equal(1); |
+ }); |
+ |
suite('edge cases', function() { |
test('knows that `spacebar` is the same as `space`', function() { |
var event = new CustomEvent('keydown'); |
@@ -242,6 +257,22 @@ suite('Polymer.IronA11yKeysBehavior', function() { |
}); |
}); |
+ suite('stopping propagation automatically', function() { |
+ setup(function() { |
+ keys = fixture('NonPropagatingKeys'); |
+ }); |
+ |
+ test('does not propagate key events beyond the combo handler', function() { |
+ var keySpy = sinon.spy(); |
+ |
+ document.addEventListener('keydown', keySpy); |
+ |
+ MockInteractions.pressEnter(keys); |
+ |
+ expect(keySpy.callCount).to.be.equal(0); |
+ }); |
+ }); |
+ |
}); |
</script> |
</body> |