| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Framework for running JavaScript tests of Polymer elements. | 6 * @fileoverview Framework for running JavaScript tests of Polymer elements. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Test fixture for Polymer element testing. | 10 * Test fixture for Polymer element testing. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 */ | 199 */ |
| 200 PolymerTest.getLibraries = function(basePath) { | 200 PolymerTest.getLibraries = function(basePath) { |
| 201 // Ensure basePath ends in '/'. | 201 // Ensure basePath ends in '/'. |
| 202 if (basePath.length && basePath[basePath.length - 1] != '/') | 202 if (basePath.length && basePath[basePath.length - 1] != '/') |
| 203 basePath += '/'; | 203 basePath += '/'; |
| 204 | 204 |
| 205 return PolymerTest.prototype.extraLibraries.map(function(library) { | 205 return PolymerTest.prototype.extraLibraries.map(function(library) { |
| 206 return basePath + library; | 206 return basePath + library; |
| 207 }); | 207 }); |
| 208 }; | 208 }; |
| 209 |
| 210 /* |
| 211 * Waits for queued up tasks to finish before proceeding. Inspired by: |
| 212 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme
nt/helpers.js#L97 |
| 213 */ |
| 214 PolymerTest.flushTasks = function() { |
| 215 Polymer.dom.flush(); |
| 216 // Promises have microtask timing, so we use setTimeout to explicity force a |
| 217 // new task. |
| 218 return new Promise(function(resolve, reject) { |
| 219 window.setTimeout(resolve, 0); |
| 220 }); |
| 221 }; |
| OLD | NEW |