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

Unified Diff: third_party/polymer/components/iron-a11y-keys-behavior/test/basic-test.html

Issue 2113853002: Run bower update (Closed) Base URL: https://github.com/catapult-project/catapult@polymer10-migration
Patch Set: Created 4 years, 6 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: third_party/polymer/components/iron-a11y-keys-behavior/test/basic-test.html
diff --git a/third_party/polymer/components/iron-a11y-keys-behavior/test/basic-test.html b/third_party/polymer/components/iron-a11y-keys-behavior/test/basic-test.html
index d53b6009fc2677fa1bb94e0ccfc635a9d5b772fc..d0c2dc35f95289255027ae27eff6c76d24021a1c 100644
--- a/third_party/polymer/components/iron-a11y-keys-behavior/test/basic-test.html
+++ b/third_party/polymer/components/iron-a11y-keys-behavior/test/basic-test.html
@@ -171,15 +171,13 @@ suite('Polymer.IronA11yKeysBehavior', function() {
MockInteractions.pressSpace(keys);
expect(keys.keyCount).to.be.equal(1);
+ });
- MockInteractions.pressAndReleaseKeyOn(keys, 27, [], 'Esc');
- expect(keys.keyCount).to.be.equal(2);
-
- MockInteractions.pressAndReleaseKeyOn(keys, 27, [], 'Escape');
- expect(keys.keyCount).to.be.equal(3);
+ test('keyEventTarget can be null, and disables listeners', function() {
+ keys.keyEventTarget = null;
+ MockInteractions.pressSpace(keys);
- MockInteractions.pressAndReleaseKeyOn(keys, 27, []);
- expect(keys.keyCount).to.be.equal(4);
+ expect(keys.keyCount).to.be.equal(0);
});
test('trigger the handler when the specified key is pressed together with a modifier', function() {
@@ -191,12 +189,22 @@ suite('Polymer.IronA11yKeysBehavior', function() {
});
test('handles special character @', function() {
- var event = new CustomEvent('keydown');
- event.key = '@';
- keys.dispatchEvent(event);
+ MockInteractions.pressAndReleaseKeyOn(keys, undefined, [], '@');
+
expect(keys.keyCount).to.be.equal(1);
});
+ test('handles variations of Esc key', function() {
+ MockInteractions.pressAndReleaseKeyOn(keys, undefined, [], 'Esc');
+ expect(keys.keyCount).to.be.equal(1);
+
+ MockInteractions.pressAndReleaseKeyOn(keys, undefined, [], 'Escape');
+ expect(keys.keyCount).to.be.equal(2);
+
+ MockInteractions.pressAndReleaseKeyOn(keys, 27, [], '');
+ expect(keys.keyCount).to.be.equal(3);
+ });
+
test('do not trigger the handler for non-specified keys', function() {
MockInteractions.pressEnter(keys);
@@ -423,6 +431,15 @@ suite('Polymer.IronA11yKeysBehavior', function() {
});
});
+ suite('remove key behavior with null target', function () {
+ test('add and remove a iron-a11y-keys-behavior', function () {
+ var element = document.createElement('x-a11y-basic-keys');
+ element.keyEventTarget = null;
+ document.body.appendChild(element);
+ document.body.removeChild(element);
+ });
+ });
+
});
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698