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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 document.head.appendChild(script); | 151 document.head.appendChild(script); |
152 return promise; | 152 return promise; |
153 }; | 153 }; |
154 | 154 |
155 /** | 155 /** |
156 * Removes all content from the body. In a vulcanized build, this retains the | 156 * Removes all content from the body. In a vulcanized build, this retains the |
157 * inlined tags so stylesheets and dom-modules are not discarded. | 157 * inlined tags so stylesheets and dom-modules are not discarded. |
158 */ | 158 */ |
159 PolymerTest.clearBody = function() { | 159 PolymerTest.clearBody = function() { |
160 // Save the div where vulcanize inlines content before clearing the page. | 160 // Save the div where vulcanize inlines content before clearing the page. |
161 var vulcanizeDiv = document.querySelector('body > div[hidden][by-vulcanize]'); | 161 var vulcanizeDiv = document.querySelector( |
| 162 'body > div[hidden][by-polymer-bundler]'); |
162 document.body.innerHTML = ''; | 163 document.body.innerHTML = ''; |
163 if (vulcanizeDiv) | 164 if (vulcanizeDiv) |
164 document.body.appendChild(vulcanizeDiv); | 165 document.body.appendChild(vulcanizeDiv); |
165 }; | 166 }; |
166 | 167 |
167 /** | 168 /** |
168 * Helper function to return the list of extra libraries relative to basePath. | 169 * Helper function to return the list of extra libraries relative to basePath. |
169 */ | 170 */ |
170 PolymerTest.getLibraries = function(basePath) { | 171 PolymerTest.getLibraries = function(basePath) { |
171 // Ensure basePath ends in '/'. | 172 // Ensure basePath ends in '/'. |
(...skipping 10 matching lines...) Expand all Loading... |
182 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme
nt/helpers.js#L97 | 183 * https://github.com/Polymer/web-component-tester/blob/master/browser/environme
nt/helpers.js#L97 |
183 */ | 184 */ |
184 PolymerTest.flushTasks = function() { | 185 PolymerTest.flushTasks = function() { |
185 Polymer.dom.flush(); | 186 Polymer.dom.flush(); |
186 // Promises have microtask timing, so we use setTimeout to explicity force a | 187 // Promises have microtask timing, so we use setTimeout to explicity force a |
187 // new task. | 188 // new task. |
188 return new Promise(function(resolve, reject) { | 189 return new Promise(function(resolve, reject) { |
189 window.setTimeout(resolve, 0); | 190 window.setTimeout(resolve, 0); |
190 }); | 191 }); |
191 }; | 192 }; |
OLD | NEW |