ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components / iron-test-helpers / test-helpers.js
blob3465186b72f8aa219eb1c84c77e8cab2761e7a63
1 /**
2 * @license
3 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 */
10 (function(global) {
12 global.flushAsynchronousOperations = function() {
13 // force distribution
14 Polymer.dom.flush();
15 // force lifecycle callback to fire on polyfill
16 window.CustomElements && window.CustomElements.takeRecords();
19 global.forceXIfStamp = function(node) {
20 var templates = Polymer.dom(node.root).querySelectorAll('template[is=dom-if]');
21 for (var tmpl, i = 0; tmpl = templates[i]; i++) {
22 tmpl.render();
25 global.flushAsynchronousOperations();
28 global.fireEvent = function(type, props, node) {
29 var event = new CustomEvent(type, {
30 bubbles: true,
31 cancelable: true
32 });
33 for (p in props) {
34 event[p] = props[p];
36 node.dispatchEvent(event);
39 })(this);