update polymer
This commit is contained in:
parent
64e22073e0
commit
3223d4672a
55 changed files with 359 additions and 253 deletions
|
@ -13,12 +13,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="test-elements.html">
|
||||
<link rel="import" href="../../paper-input/paper-input.html">
|
||||
</head>
|
||||
<body>
|
||||
<test-fixture id="TrivialActiveState">
|
||||
|
@ -33,12 +30,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="ButtonWithInput">
|
||||
<test-fixture id="ButtonWithNativeInput">
|
||||
<template>
|
||||
<test-light-dom><input id="input"></test-light-dom>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="ButtonWithPaperInput">
|
||||
<template>
|
||||
<test-light-dom><paper-input id="input"></paper-input></test-light-dom>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('active-state', function() {
|
||||
var activeTarget;
|
||||
|
@ -199,9 +202,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
});
|
||||
|
||||
suite('nested input inside button', function() {
|
||||
suite('nested native input inside button', function() {
|
||||
test('space in light child input does not trigger a button click event', function(done) {
|
||||
var item = fixture('ButtonWithInput');
|
||||
var item = fixture('ButtonWithNativeInput');
|
||||
var input = item.querySelector('#input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
|
@ -209,14 +212,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
input.focus();
|
||||
MockInteractions.pressSpace(input);
|
||||
setTimeout(function(){
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(0);
|
||||
done();
|
||||
}, 100);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('space in button triggers a button click event', function(done) {
|
||||
var item = fixture('ButtonWithInput');
|
||||
var item = fixture('ButtonWithNativeInput');
|
||||
var input = item.querySelector('#input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
|
@ -224,10 +227,49 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
MockInteractions.pressSpace(item);
|
||||
|
||||
setTimeout(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(1);
|
||||
Polymer.Base.async(function(){
|
||||
// You need two ticks, one for the MockInteractions event, and one
|
||||
// for the button event.
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(1);
|
||||
done();
|
||||
}, 1);
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('nested paper-input inside button', function() {
|
||||
test('space in light child input does not trigger a button click event', function(done) {
|
||||
var item = fixture('ButtonWithPaperInput');
|
||||
var input = item.querySelector('#input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
item.addEventListener('click', itemClickHandler);
|
||||
|
||||
input.focus();
|
||||
MockInteractions.pressSpace(input);
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(0);
|
||||
done();
|
||||
}, 100);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('space in button triggers a button click event', function(done) {
|
||||
var item = fixture('ButtonWithPaperInput');
|
||||
var input = item.querySelector('#input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
item.addEventListener('click', itemClickHandler);
|
||||
|
||||
MockInteractions.pressSpace(item);
|
||||
Polymer.Base.async(function(){
|
||||
// You need two ticks, one for the MockInteractions event, and one
|
||||
// for the button event.
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(1);
|
||||
done();
|
||||
}, 1);
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -13,10 +13,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="test-elements.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -13,11 +13,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="test-elements.html">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -135,12 +131,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
lightDOM.addEventListener('focus', function() {
|
||||
nFocusEvents += 1;
|
||||
});
|
||||
|
||||
|
||||
MockInteractions.focus(input);
|
||||
|
||||
expect(nFocusEvents).to.be.equal(0);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -7,6 +7,7 @@ Code distributed by Google as part of the polymer project is also
|
|||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-control-state.html">
|
||||
<link rel="import" href="../iron-button-state.html">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue