Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: lib/src/iron-a11y-keys-behavior/test/basic-test.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698