Index: third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js |
diff --git a/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js b/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js |
index adaf692e9de6622344c083ad162ebb411eb6e11f..b48bbb9ba8742cf4e7ce71566c74d50e8eaf4f10 100644 |
--- a/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js |
+++ b/third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js |
@@ -10,6 +10,11 @@ |
(function(global) { |
'use strict'; |
+ /* |
+ * Forces distribution of light children, and lifecycle callbacks on the |
+ * Custom Elements polyfill. Used when testing elements that rely on their |
+ * distributed children. |
+ */ |
global.flushAsynchronousOperations = function() { |
// force distribution |
Polymer.dom.flush(); |
@@ -17,6 +22,11 @@ |
window.CustomElements && window.CustomElements.takeRecords(); |
}; |
+ /* |
+ * Stamps and renders a `dom-if` template. |
+ * |
+ * @param {HTMLElement} node The node containing the template, |
+ */ |
global.forceXIfStamp = function(node) { |
var templates = Polymer.dom(node.root).querySelectorAll('template[is=dom-if]'); |
for (var tmpl, i = 0; tmpl = templates[i]; i++) { |
@@ -26,6 +36,13 @@ |
global.flushAsynchronousOperations(); |
}; |
+ /* |
+ * Fires a custom event on a specific node. This event bubbles and is cancellable. |
+ * |
+ * @param {String} type The type of event. |
+ * @param {Object} props Any custom properties the event contains. |
+ * @param {HTMLElement} node The node to fire the event on. |
+ */ |
global.fireEvent = function(type, props, node) { |
var event = new CustomEvent(type, { |
bubbles: true, |
@@ -37,6 +54,19 @@ |
node.dispatchEvent(event); |
}; |
+ /* |
+ * Skips a test unless a condition is met. Sample use: |
+ * function isNotIE() { |
+ * return !navigator.userAgent.match(/MSIE/i); |
+ * } |
+ * test('runs on non IE browsers', skipUnless(isNotIE, function() { |
+ * ... |
+ * }); |
+ * |
+ * @param {String} condition The name of a Boolean function determining if the test should be run. |
+ * @param {Function} test The test to be run. |
+ */ |
+ |
global.skipUnless = function(condition, test) { |
var isAsyncTest = !!test.length; |