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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-test-helpers/test-helpers.js

Issue 1766433002: Roll Polymer to 1.3.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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: 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;

Powered by Google App Engine
This is Rietveld 408576698