update popups

This commit is contained in:
Luke Pulverenti 2015-12-02 22:20:52 -05:00
parent ae5ccc79dc
commit a5be57afdc
19 changed files with 255 additions and 78 deletions

View file

@ -17,8 +17,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<link rel="import" href="test-menu.html">
</head>
@ -44,6 +46,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="nested">
<template>
<test-menu>
<test-menu>
<div>item 1</div>
<div>item 2</div>
<div>item 3</div>
</test-menu>
</test-menu>
</template>
</test-fixture>
<script>
suite('menu a11y tests', function() {
@ -96,6 +111,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, 200);
});
test('keyboard events should not bubble', function(done) {
var menu = fixture('nested');
var keyCounter = 0;
menu.addEventListener('keydown', function(event) {
if (menu.keyboardEventMatchesKeys(event, 'esc')) {
keyCounter++;
}
if (menu.keyboardEventMatchesKeys(event, 'up')) {
keyCounter++;
}
if (menu.keyboardEventMatchesKeys(event, 'down')) {
keyCounter++;
}
});
// up
MockInteractions.keyDownOn(menu.firstElementChild, 38);
// down
MockInteractions.keyDownOn(menu.firstElementChild, 40);
// esc
MockInteractions.keyDownOn(menu.firstElementChild, 27);
setTimeout(function() {
assert.equal(menu.firstElementChild.tagName, 'TEST-MENU');
assert.equal(keyCounter, 0);
done();
}, 200);
});
});
</script>