update components

This commit is contained in:
Luke Pulverenti 2016-03-15 22:46:13 -04:00
parent 48d4b0c287
commit c389d502e0
9 changed files with 95 additions and 41 deletions

View file

@ -48,6 +48,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="nestedDrawer">
<template>
<paper-drawer-panel force-narrow>
<div drawer>
<input id="innerLink1" tabindex="0" value="inside drawer 1">
</div>
<paper-drawer-panel id="drawer2" main force-narrow>
<div drawer>
<input id="innerLink2" tabindex="0" value="inside drawer 2">
</div>
<div main>
<input id="outerLink" tabindex="0" value="outside drawer">
</div>
</paper-drawer-panel>
</paper-drawer-panel>
</template>
</test-fixture>
<script>
function ensureDocumentHasFocus() {
window.top && window.top.focus();
@ -73,6 +92,39 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
suite('nested drawers', function() {
var drawer1, drawer2, innerLink1, innerLink2;
setup(function() {
drawer1 = fixture('nestedDrawer');
drawer2 = drawer1.querySelector('#drawer2');
innerLink1 = drawer1.querySelector('#innerLink1');
innerLink2 = drawer1.querySelector('#innerLink2');
ensureDocumentHasFocus();
});
test('should not cause stack overflow', function(done) {
var count = 0;
var spy = sinon.spy();
drawer1.openDrawer();
drawer2.openDrawer();
document.addEventListener('focus', spy, true);
MockInteractions.focus(innerLink1);
MockInteractions.focus(innerLink2);
Polymer.Base.async(function() {
if (spy.callCount > 10) {
throw new Error('stack overflow');
}
done();
}, 100);
});
});
</script>
</body>
</html>