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

Unified Diff: polymer_1.2.3/bower_components/iron-behaviors/test/focused-state.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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: polymer_1.2.3/bower_components/iron-behaviors/test/focused-state.html
diff --git a/polymer_1.0.4/bower_components/iron-behaviors/test/focused-state.html b/polymer_1.2.3/bower_components/iron-behaviors/test/focused-state.html
similarity index 76%
copy from polymer_1.0.4/bower_components/iron-behaviors/test/focused-state.html
copy to polymer_1.2.3/bower_components/iron-behaviors/test/focused-state.html
index 2d3af69b32faa623d828283d95a25873e2c94f71..e17c7f95aba48cf418d2498c28765696cdca2570 100644
--- a/polymer_1.0.4/bower_components/iron-behaviors/test/focused-state.html
+++ b/polymer_1.2.3/bower_components/iron-behaviors/test/focused-state.html
@@ -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>
@@ -34,6 +30,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
+ <test-fixture id="LightDOM">
+ <template>
+ <test-light-dom>
+ <input id="input">
+ </test-light-dom>
+ </template>
+ </test-fixture>
+
<script>
suite('focused-state', function() {
var focusTarget;
@@ -90,26 +94,47 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
focusable = fixture('NestedFocusedState');
});
- test('focus/blur events fired on host element', function(done) {
+ test('focus/blur events fired on host element', function() {
var nFocusEvents = 0;
var nBlurEvents = 0;
+
focusable.addEventListener('focus', function() {
nFocusEvents += 1;
- // setTimeout to wait for potentially more, erroneous events
- setTimeout(function() {
- assert.equal(nFocusEvents, 1, 'one focus event fired');
- MockInteractions.blur(focusable.$.input);
- });
+ expect(focusable.focused).to.be.equal(true);
+ MockInteractions.blur(focusable.$.input);
});
focusable.addEventListener('blur', function() {
+ expect(focusable.focused).to.be.equal(false);
nBlurEvents += 1;
- // setTimeout to wait for potentially more, erroneous events
- setTimeout(function() {
- assert.equal(nBlurEvents, 1, 'one blur event fired');
- done();
- });
});
+
MockInteractions.focus(focusable.$.input);
+
+ expect(nBlurEvents).to.be.greaterThan(0);
+ expect(nFocusEvents).to.be.greaterThan(0);
+ });
+
+ });
+
+
+ suite('elements in the light dom', function() {
+ var lightDOM, input;
+
+ setup(function() {
+ lightDOM = fixture('LightDOM');
+ input = document.querySelector('#input');
+ });
+
+ test('should not fire the focus event', function() {
+ var nFocusEvents = 0;
+
+ lightDOM.addEventListener('focus', function() {
+ nFocusEvents += 1;
+ });
+
+ MockInteractions.focus(input);
+
+ expect(nFocusEvents).to.be.equal(0);
});
});

Powered by Google App Engine
This is Rietveld 408576698