diff --git a/bower.json b/bower.json index b03e5dfa..2f2a3824 100644 --- a/bower.json +++ b/bower.json @@ -33,7 +33,7 @@ "stacky": "^1.3.0", "test-fixture": "polymerelements/test-fixture#^1.0.0" }, - "version": "4.3.0", + "version": "4.3.1", "devDependencies": { "polymer": "Polymer/polymer#^1.5.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.22" diff --git a/browser.js b/browser.js index e886298f..77ecfbd8 100644 --- a/browser.js +++ b/browser.js @@ -1549,6 +1549,17 @@ extendInterfaces('replace', function(context, teardown) { } if (instanceParent) { + // Polymer's shady dom implementation goes through the insertion + // points and checks their parents. If the parent of a content + // tag has been stamped already, then Polymer.dom has to be aware + // of this content tag's parent. Additionally, + // Polymer.dom.appendChild does not seem to actually append the + // content nodes into the document fragment, so node.appendChild + // must also be called to actually insert the node. + if (instanceNode.tagName == 'CONTENT') { + Polymer.dom(instanceParent).appendChild(instanceNode); + } + instanceParent.appendChild(instanceNode); } @@ -1557,26 +1568,18 @@ extendInterfaces('replace', function(context, teardown) { instanceParent = instanceNode; templateNode = templateNode.firstChild; - // traverse laterally if you cannot traverse down - } else if (templateNode.nextSibling) { - templateNode = templateNode.nextSibling; - - // if the parent is the dom, we are done - } else if (templateNode.parentNode === dom) { - instanceParent = instanceNode.parentNode; - return instanceParent; - // traverse up } else { // traverse up until you can move laterally while (!templateNode.nextSibling) { - templateNode = templateNode.parentNode; - instanceParent = instanceParent.parentNode; - // stop traversing up if we are at the top - if (templateNode === dom) { + if (templateNode.parentNode === dom) { return instanceParent; + } else { + instanceParent = instanceParent.parentNode; } + + templateNode = templateNode.parentNode; } // traverse laterally diff --git a/browser.js.map b/browser.js.map index 428345d7..35a5e6d1 100644 --- a/browser.js.map +++ b/browser.js.map @@ -1 +1 @@ -{"version":3,"file":"browser.js.map","sources":["browser/util.js","browser/childrunner.js","browser/config.js","browser/suites.js","browser/reporters/console.js","browser/reporters/html.js","browser/reporters/multi.js","browser/reporters/title.js","browser/reporters.js","browser/environment.js","browser/environment/errors.js","browser/mocha/extend.js","browser/mocha/fixture.js","browser/mocha/stub.js","browser/mocha/replace.js","browser/mocha.js","browser/clisocket.js","browser/environment/helpers.js","browser/index.js"],"sourcesContent":["/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport * as config from './config.js';\n\n/**\n * @param {function()} callback A function to call when the active web component\n * frameworks have loaded.\n */\nexport function whenFrameworksReady(callback) {\n debug('whenFrameworksReady');\n var done = function() {\n debug('whenFrameworksReady done');\n callback();\n };\n\n function whenWebComponentsReady() {\n debug('WebComponentsReady?');\n if (window.WebComponents && WebComponents.whenReady) {\n WebComponents.whenReady(function() {\n debug('WebComponents Ready');\n done();\n });\n } else {\n var after = function after() {\n window.removeEventListener('WebComponentsReady', after);\n debug('WebComponentsReady');\n done();\n };\n window.addEventListener('WebComponentsReady', after);\n }\n }\n\n function importsReady() {\n // handle Polymer 0.5 readiness\n debug('Polymer ready?');\n if (window.Polymer && Polymer.whenReady) {\n Polymer.whenReady(function() {\n debug('Polymer ready');\n done();\n });\n } else {\n whenWebComponentsReady();\n }\n }\n\n // All our supported framework configurations depend on imports.\n if (!window.HTMLImports) {\n done();\n } else if (HTMLImports.ready) {\n debug('HTMLImports ready');\n importsReady();\n } else if (HTMLImports.whenReady) {\n HTMLImports.whenReady(function() {\n debug('HTMLImports.whenReady ready');\n importsReady();\n });\n } else {\n whenWebComponentsReady();\n }\n}\n\n/**\n * @param {number} count\n * @param {string} kind\n * @return {string} ' tests' or ' test'.\n */\nexport function pluralizedStat(count, kind) {\n if (count === 1) {\n return count + ' ' + kind + ' test';\n } else {\n return count + ' ' + kind + ' tests';\n }\n}\n\n/**\n * @param {string} path The URI of the script to load.\n * @param {function} done\n */\nexport function loadScript(path, done) {\n var script = document.createElement('script');\n script.src = path;\n if (done) {\n script.onload = done.bind(null, null);\n script.onerror = done.bind(null, 'Failed to load script ' + script.src);\n }\n document.head.appendChild(script);\n}\n\n/**\n * @param {string} path The URI of the stylesheet to load.\n * @param {function} done\n */\nexport function loadStyle(path, done) {\n var link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = path;\n if (done) {\n link.onload = done.bind(null, null);\n link.onerror = done.bind(null, 'Failed to load stylesheet ' + link.href);\n }\n document.head.appendChild(link);\n}\n\n/**\n * @param {...*} var_args Logs values to the console when the `debug`\n * configuration option is true.\n */\nexport function debug(var_args) {\n if (!config.get('verbose')) return;\n var args = [window.location.pathname];\n args.push.apply(args, arguments);\n (console.debug || console.log).apply(console, args);\n}\n\n// URL Processing\n\n/**\n * @param {string} url\n * @return {{base: string, params: string}}\n */\nexport function parseUrl(url) {\n var parts = url.match(/^(.*?)(?:\\?(.*))?$/);\n return {\n base: parts[1],\n params: getParams(parts[2] || ''),\n };\n}\n\n/**\n * Expands a URL that may or may not be relative to `base`.\n *\n * @param {string} url\n * @param {string} base\n * @return {string}\n */\nexport function expandUrl(url, base) {\n if (!base) return url;\n if (url.match(/^(\\/|https?:\\/\\/)/)) return url;\n if (base.substr(base.length - 1) !== '/') {\n base = base + '/';\n }\n return base + url;\n}\n\n/**\n * @param {string=} opt_query A query string to parse.\n * @return {!Object>} All params on the URL's query.\n */\nexport function getParams(opt_query) {\n var query = typeof opt_query === 'string' ? opt_query : window.location.search;\n if (query.substring(0, 1) === '?') {\n query = query.substring(1);\n }\n // python's SimpleHTTPServer tacks a `/` on the end of query strings :(\n if (query.slice(-1) === '/') {\n query = query.substring(0, query.length - 1);\n }\n if (query === '') return {};\n\n var result = {};\n query.split('&').forEach(function(part) {\n var pair = part.split('=');\n if (pair.length !== 2) {\n console.warn('Invalid URL query part:', part);\n return;\n }\n var key = decodeURIComponent(pair[0]);\n var value = decodeURIComponent(pair[1]);\n\n if (!result[key]) {\n result[key] = [];\n }\n result[key].push(value);\n });\n\n return result;\n}\n\n/**\n * Merges params from `source` into `target` (mutating `target`).\n *\n * @param {!Object>} target\n * @param {!Object>} source\n */\nexport function mergeParams(target, source) {\n Object.keys(source).forEach(function(key) {\n if (!(key in target)) {\n target[key] = [];\n }\n target[key] = target[key].concat(source[key]);\n });\n}\n\n/**\n * @param {string} param The param to return a value for.\n * @return {?string} The first value for `param`, if found.\n */\nexport function getParam(param) {\n var params = getParams();\n return params[param] ? params[param][0] : null;\n}\n\n/**\n * @param {!Object>} params\n * @return {string} `params` encoded as a URI query.\n */\nexport function paramsToQuery(params) {\n var pairs = [];\n Object.keys(params).forEach(function(key) {\n params[key].forEach(function(value) {\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n });\n });\n return (pairs.length > 0) ? ('?' + pairs.join('&')) : '';\n}\n\n/**\n * @param {!Location|string} location\n * @return {string}\n */\nexport function basePath(location) {\n return (location.pathname || location).match(/^.*\\//)[0];\n}\n\n/**\n * @param {!Location|string} location\n * @param {string} basePath\n * @return {string}\n */\nexport function relativeLocation(location, basePath) {\n var path = location.pathname || location;\n if (path.indexOf(basePath) === 0) {\n path = path.substring(basePath.length);\n }\n return path;\n}\n\n/**\n * @param {!Location|string} location\n * @return {string}\n */\nexport function cleanLocation(location) {\n var path = location.pathname || location;\n if (path.slice(-11) === '/index.html') {\n path = path.slice(0, path.length - 10);\n }\n return path;\n}\n\n/**\n * Like `async.parallelLimit`, but our own so that we don't force a dependency\n * on downstream code.\n *\n * @param {!Array} runners Runners that call their given\n * Node-style callback when done.\n * @param {number|function(*)} limit Maximum number of concurrent runners.\n * (optional).\n * @param {?function(*)} done Callback that should be triggered once all runners\n * have completed, or encountered an error.\n */\nexport function parallel(runners, limit, done) {\n if (typeof limit !== 'number') {\n done = limit;\n limit = 0;\n }\n if (!runners.length) return done();\n\n var called = false;\n var total = runners.length;\n var numActive = 0;\n var numDone = 0;\n\n function runnerDone(error) {\n if (called) return;\n numDone = numDone + 1;\n numActive = numActive - 1;\n\n if (error || numDone >= total) {\n called = true;\n done(error);\n } else {\n runOne();\n }\n }\n\n function runOne() {\n if (limit && numActive >= limit) return;\n if (!runners.length) return;\n numActive = numActive + 1;\n runners.shift()(runnerDone);\n }\n runners.forEach(runOne);\n}\n\n/**\n * Finds the directory that a loaded script is hosted on.\n *\n * @param {string} filename\n * @return {string?}\n */\nexport function scriptPrefix(filename) {\n var scripts = document.querySelectorAll('script[src*=\"' + filename + '\"]');\n if (scripts.length !== 1) return null;\n var script = scripts[0].src;\n return script.substring(0, script.indexOf(filename));\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from './util.js';\n\n// TODO(thedeeno): Consider renaming subsuite. IIRC, childRunner is entirely\n// distinct from mocha suite, which tripped me up badly when trying to add\n// plugin support. Perhaps something like 'batch', or 'bundle'. Something that\n// has no mocha correlate. This may also eliminate the need for root/non-root\n// suite distinctions.\n\n/**\n * A Mocha suite (or suites) run within a child iframe, but reported as if they\n * are part of the current context.\n */\nexport default function ChildRunner(url, parentScope) {\n var urlBits = util.parseUrl(url);\n util.mergeParams(\n urlBits.params, util.getParams(parentScope.location.search));\n delete urlBits.params.cli_browser_id;\n\n this.url = urlBits.base + util.paramsToQuery(urlBits.params);\n this.parentScope = parentScope;\n\n this.state = 'initializing';\n}\n\n// ChildRunners get a pretty generous load timeout by default.\nChildRunner.loadTimeout = 60000;\n\n// We can't maintain properties on iframe elements in Firefox/Safari/???, so we\n// track childRunners by URL.\nChildRunner._byUrl = {};\n\n/**\n * @return {ChildRunner} The `ChildRunner` that was registered for this window.\n */\nChildRunner.current = function() {\n return ChildRunner.get(window);\n};\n\n/**\n * @param {!Window} target A window to find the ChildRunner of.\n * @param {boolean} traversal Whether this is a traversal from a child window.\n * @return {ChildRunner} The `ChildRunner` that was registered for `target`.\n */\nChildRunner.get = function(target, traversal) {\n var childRunner = ChildRunner._byUrl[target.location.href];\n if (childRunner) return childRunner;\n if (window.parent === window) { // Top window.\n if (traversal) {\n console.warn('Subsuite loaded but was never registered. This most likely is due to wonky history behavior. Reloading...');\n window.location.reload();\n }\n return null;\n }\n // Otherwise, traverse.\n return window.parent.WCT._ChildRunner.get(target, true);\n};\n\n/**\n * Loads and runs the subsuite.\n *\n * @param {function} done Node-style callback.\n */\nChildRunner.prototype.run = function(done) {\n util.debug('ChildRunner#run', this.url);\n this.state = 'loading';\n this.onRunComplete = done;\n\n this.iframe = document.createElement('iframe');\n this.iframe.src = this.url;\n this.iframe.classList.add('subsuite');\n\n var container = document.getElementById('subsuites');\n if (!container) {\n container = document.createElement('div');\n container.id = 'subsuites';\n document.body.appendChild(container);\n }\n container.appendChild(this.iframe);\n\n // let the iframe expand the URL for us.\n this.url = this.iframe.src;\n ChildRunner._byUrl[this.url] = this;\n\n this.timeoutId = setTimeout(\n this.loaded.bind(this, new Error('Timed out loading ' + this.url)), ChildRunner.loadTimeout);\n\n this.iframe.addEventListener('error',\n this.loaded.bind(this, new Error('Failed to load document ' + this.url)));\n\n this.iframe.contentWindow.addEventListener('DOMContentLoaded', this.loaded.bind(this, null));\n};\n\n/**\n * Called when the sub suite's iframe has loaded (or errored during load).\n *\n * @param {*} error The error that occured, if any.\n */\nChildRunner.prototype.loaded = function(error) {\n util.debug('ChildRunner#loaded', this.url, error);\n\n // Not all targets have WCT loaded (compatiblity mode)\n if (this.iframe.contentWindow.WCT) {\n this.share = this.iframe.contentWindow.WCT.share;\n }\n\n if (error) {\n this.signalRunComplete(error);\n this.done();\n }\n};\n\n/**\n * Called in mocha/run.js when all dependencies have loaded, and the child is\n * ready to start running tests\n *\n * @param {*} error The error that occured, if any.\n */\nChildRunner.prototype.ready = function(error) {\n util.debug('ChildRunner#ready', this.url, error);\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n if (error) {\n this.signalRunComplete(error);\n this.done();\n }\n};\n\n/** Called when the sub suite's tests are complete, so that it can clean up. */\nChildRunner.prototype.done = function done() {\n util.debug('ChildRunner#done', this.url, arguments);\n\n // make sure to clear that timeout\n this.ready();\n this.signalRunComplete();\n\n if (!this.iframe) return;\n // Be safe and avoid potential browser crashes when logic attempts to interact\n // with the removed iframe.\n setTimeout(function() {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }.bind(this), 1);\n};\n\nChildRunner.prototype.signalRunComplete = function signalRunComplete(error) {\n if (!this.onRunComplete) return;\n this.state = 'complete';\n this.onRunComplete(error);\n this.onRunComplete = null;\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from './util.js';\nimport ChildRunner from './childrunner.js';\n\n/**\n * The global configuration state for WCT's browser client.\n */\nexport var _config = {\n /**\n * `.js` scripts to be loaded (synchronously) before WCT starts in earnest.\n *\n * Paths are relative to `scriptPrefix`.\n */\n environmentScripts: [\n 'stacky/browser.js',\n 'async/lib/async.js',\n 'lodash/lodash.js',\n 'mocha/mocha.js',\n 'chai/chai.js',\n 'sinonjs/sinon.js',\n 'sinon-chai/lib/sinon-chai.js',\n 'accessibility-developer-tools/dist/js/axs_testing.js'\n ],\n\n environmentImports: [\n 'test-fixture/test-fixture.html'\n ],\n\n /** Absolute root for client scripts. Detected in `setup()` if not set. */\n root: null,\n\n /** By default, we wait for any web component frameworks to load. */\n waitForFrameworks: true,\n\n /** Alternate callback for waiting for tests.\n * `this` for the callback will be the window currently running tests.\n */\n waitFor: null,\n\n /** How many `.html` suites that can be concurrently loaded & run. */\n numConcurrentSuites: 1,\n\n /** Whether `console.error` should be treated as a test failure. */\n trackConsoleError: true,\n\n /** Configuration passed to mocha.setup. */\n mochaOptions: {\n timeout: 10 * 1000\n },\n\n /** Whether WCT should emit (extremely verbose) debugging log messages. */\n verbose: false,\n};\n\n/**\n * Merges initial `options` into WCT's global configuration.\n *\n * @param {Object} options The options to merge. See `browser/config.js` for a\n * reference.\n */\nexport function setup(options) {\n var childRunner = ChildRunner.current();\n if (childRunner) {\n _deepMerge(_config, childRunner.parentScope.WCT._config);\n // But do not force the mocha UI\n delete _config.mochaOptions.ui;\n }\n\n if (options && typeof options === 'object') {\n _deepMerge(_config, options);\n }\n\n if (!_config.root) {\n // Sibling dependencies.\n var root = util.scriptPrefix('browser.js');\n _config.root = util.basePath(root.substr(0, root.length - 1));\n if (!_config.root) {\n throw new Error('Unable to detect root URL for WCT sources. Please set WCT.root before including browser.js');\n }\n }\n}\n\n/**\n * Retrieves a configuration value.\n *\n * @param {string} key\n * @return {*}\n */\nexport function get(key) {\n return _config[key];\n}\n\n// Internal\n\nfunction _deepMerge(target, source) {\n Object.keys(source).forEach(function(key) {\n if (target[key] !== null && typeof target[key] === 'object' && !Array.isArray(target[key])) {\n _deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as config from './config.js';\nimport * as util from './util.js';\nimport ChildRunner from './childrunner.js';\n\nexport var htmlSuites = [];\nexport var jsSuites = [];\n\n// We process grep ourselves to avoid loading suites that will be filtered.\nvar GREP = util.getParam('grep');\n// work around mocha bug (https://github.com/mochajs/mocha/issues/2070)\nif (GREP) {\n GREP = GREP.replace(/\\\\\\./g, '.');\n}\n\n/**\n * Loads suites of tests, supporting both `.js` and `.html` files.\n *\n * @param {!Array.} files The files to load.\n */\nexport function loadSuites(files) {\n files.forEach(function(file) {\n if (/\\.js(\\?.*)?$/.test(file)) {\n jsSuites.push(file);\n } else if (/\\.html(\\?.*)?$/.test(file)) {\n htmlSuites.push(file);\n } else {\n throw new Error('Unknown resource type: ' + file);\n }\n });\n}\n\n/**\n * @return {!Array.} The child suites that should be loaded, ignoring\n * those that would not match `GREP`.\n */\nexport function activeChildSuites() {\n var subsuites = htmlSuites;\n if (GREP) {\n var cleanSubsuites = [];\n for (var i = 0, subsuite; subsuite = subsuites[i]; i++) {\n if (GREP.indexOf(util.cleanLocation(subsuite)) !== -1) {\n cleanSubsuites.push(subsuite);\n }\n }\n subsuites = cleanSubsuites;\n }\n return subsuites;\n}\n\n/**\n * Loads all `.js` sources requested by the current suite.\n *\n * @param {!MultiReporter} reporter\n * @param {function} done\n */\nexport function loadJsSuites(reporter, done) {\n util.debug('loadJsSuites', jsSuites);\n\n var loaders = jsSuites.map(function(file) {\n // We only support `.js` dependencies for now.\n return util.loadScript.bind(util, file);\n });\n\n util.parallel(loaders, done);\n}\n\n/**\n * @param {!MultiReporter} reporter\n * @param {!Array.} childSuites\n * @param {function} done\n */\nexport function runSuites(reporter, childSuites, done) {\n util.debug('runSuites');\n\n var suiteRunners = [\n // Run the local tests (if any) first, not stopping on error;\n _runMocha.bind(null, reporter),\n ];\n\n // As well as any sub suites. Again, don't stop on error.\n childSuites.forEach(function(file) {\n suiteRunners.push(function(next) {\n var childRunner = new ChildRunner(file, window);\n reporter.emit('childRunner start', childRunner);\n childRunner.run(function(error) {\n reporter.emit('childRunner end', childRunner);\n if (error) reporter.emitOutOfBandTest(file, error);\n next();\n });\n });\n });\n\n util.parallel(suiteRunners, config.get('numConcurrentSuites'), function(error) {\n reporter.done();\n done(error);\n });\n}\n\n/**\n * Kicks off a mocha run, waiting for frameworks to load if necessary.\n *\n * @param {!MultiReporter} reporter Where to send Mocha's events.\n * @param {function} done A callback fired, _no error is passed_.\n */\nfunction _runMocha(reporter, done, waited) {\n if (config.get('waitForFrameworks') && !waited) {\n var waitFor = (config.get('waitFor') || util.whenFrameworksReady).bind(window);\n waitFor(_runMocha.bind(null, reporter, done, true));\n return;\n }\n util.debug('_runMocha');\n var mocha = window.mocha;\n var Mocha = window.Mocha;\n\n mocha.reporter(reporter.childReporter(window.location));\n mocha.suite.title = reporter.suiteTitle(window.location);\n mocha.grep(GREP);\n\n // We can't use `mocha.run` because it bashes over grep, invert, and friends.\n // See https://github.com/visionmedia/mocha/blob/master/support/tail.js#L137\n var runner = Mocha.prototype.run.call(mocha, function(error) {\n if (document.getElementById('mocha')) {\n Mocha.utils.highlightTags('code');\n }\n done(); // We ignore the Mocha failure count.\n });\n\n // Mocha's default `onerror` handling strips the stack (to support really old\n // browsers). We upgrade this to get better stacks for async errors.\n //\n // TODO(nevir): Can we expand support to other browsers?\n if (navigator.userAgent.match(/chrome/i)) {\n window.onerror = null;\n window.addEventListener('error', function(event) {\n if (!event.error) return;\n if (event.error.ignore) return;\n runner.uncaught(event.error);\n });\n }\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from '../util.js';\n\n// We capture console events when running tests; so make sure we have a\n// reference to the original one.\nvar console = window.console;\n\nvar FONT = ';font: normal 13px \"Roboto\", \"Helvetica Neue\", \"Helvetica\", sans-serif;';\nvar STYLES = {\n plain: FONT,\n suite: 'color: #5c6bc0' + FONT,\n test: FONT,\n passing: 'color: #259b24' + FONT,\n pending: 'color: #e65100' + FONT,\n failing: 'color: #c41411' + FONT,\n stack: 'color: #c41411',\n results: FONT + 'font-size: 16px',\n};\n\n// I don't think we can feature detect this one...\nvar userAgent = navigator.userAgent.toLowerCase();\nvar CAN_STYLE_LOG = userAgent.match('firefox') || userAgent.match('webkit');\nvar CAN_STYLE_GROUP = userAgent.match('webkit');\n// Track the indent for faked `console.group`\nvar logIndent = '';\n\nfunction log(text, style) {\n text = text.split('\\n').map(function(l) { return logIndent + l; }).join('\\n');\n if (CAN_STYLE_LOG) {\n console.log('%c' + text, STYLES[style] || STYLES.plain);\n } else {\n console.log(text);\n }\n}\n\nfunction logGroup(text, style) {\n if (CAN_STYLE_GROUP) {\n console.group('%c' + text, STYLES[style] || STYLES.plain);\n } else if (console.group) {\n console.group(text);\n } else {\n logIndent = logIndent + ' ';\n log(text, style);\n }\n}\n\nfunction logGroupEnd() {\n if (console.groupEnd) {\n console.groupEnd();\n } else {\n logIndent = logIndent.substr(0, logIndent.length - 2);\n }\n}\n\nfunction logException(error) {\n log(error.stack || error.message || error, 'stack');\n}\n\n/**\n * A Mocha reporter that logs results out to the web `console`.\n *\n * @param {!Mocha.Runner} runner The runner that is being reported on.\n */\nexport default function Console(runner) {\n Mocha.reporters.Base.call(this, runner);\n\n runner.on('suite', function(suite) {\n if (suite.root) return;\n logGroup(suite.title, 'suite');\n }.bind(this));\n\n runner.on('suite end', function(suite) {\n if (suite.root) return;\n logGroupEnd();\n }.bind(this));\n\n runner.on('test', function(test) {\n logGroup(test.title, 'test');\n }.bind(this));\n\n runner.on('pending', function(test) {\n logGroup(test.title, 'pending');\n }.bind(this));\n\n runner.on('fail', function(test, error) {\n logException(error);\n }.bind(this));\n\n runner.on('test end', function(test) {\n logGroupEnd();\n }.bind(this));\n\n runner.on('end', this.logSummary.bind(this));\n}\n\n/** Prints out a final summary of test results. */\nConsole.prototype.logSummary = function logSummary() {\n logGroup('Test Results', 'results');\n\n if (this.stats.failures > 0) {\n log(util.pluralizedStat(this.stats.failures, 'failing'), 'failing');\n }\n if (this.stats.pending > 0) {\n log(util.pluralizedStat(this.stats.pending, 'pending'), 'pending');\n }\n log(util.pluralizedStat(this.stats.passes, 'passing'));\n\n if (!this.stats.failures) {\n log('test suite passed', 'passing');\n }\n log('Evaluated ' + this.stats.tests + ' tests in ' + this.stats.duration + 'ms.');\n logGroupEnd();\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * WCT-specific behavior on top of Mocha's default HTML reporter.\n *\n * @param {!Mocha.Runner} runner The runner that is being reported on.\n */\nexport default function HTML(runner) {\n var output = document.createElement('div');\n output.id = 'mocha';\n document.body.appendChild(output);\n\n runner.on('suite', function(test) {\n this.total = runner.total;\n }.bind(this));\n\n Mocha.reporters.HTML.call(this, runner);\n}\n\n// Woo! What a hack. This just saves us from adding a bunch of complexity around\n// style loading.\nvar style = document.createElement('style');\nstyle.textContent = 'html, body {' +\n ' position: relative;' +\n ' height: 100%;' +\n ' width: 100%;' +\n ' min-width: 900px;' +\n '}' +\n '#mocha, #subsuites {' +\n ' height: 100%;' +\n ' position: absolute;' +\n ' top: 0;' +\n '}' +\n '#mocha {' +\n ' box-sizing: border-box;' +\n ' margin: 0 !important;' +\n ' overflow-y: auto;' +\n ' padding: 60px 20px;' +\n ' right: 0;' +\n ' left: 500px;' +\n '}' +\n '#subsuites {' +\n ' -ms-flex-direction: column;' +\n ' -webkit-flex-direction: column;' +\n ' display: -ms-flexbox;' +\n ' display: -webkit-flex;' +\n ' display: flex;' +\n ' flex-direction: column;' +\n ' left: 0;' +\n ' width: 500px;' +\n '}' +\n '#subsuites .subsuite {' +\n ' border: 0;' +\n ' width: 100%;' +\n ' height: 100%;' +\n '}' +\n '#mocha .test.pass .duration {' +\n ' color: #555 !important;' +\n '}';\ndocument.head.appendChild(style);\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from '../util.js';\n\nvar STACKY_CONFIG = {\n indent: ' ',\n locationStrip: [\n /^https?:\\/\\/[^\\/]+/,\n /\\?.*$/,\n ],\n filter: function(line) {\n return line.location.match(/\\/web-component-tester\\/[^\\/]+(\\?.*)?$/);\n },\n};\n\n// https://github.com/visionmedia/mocha/blob/master/lib/runner.js#L36-46\nvar MOCHA_EVENTS = [\n 'start',\n 'end',\n 'suite',\n 'suite end',\n 'test',\n 'test end',\n 'hook',\n 'hook end',\n 'pass',\n 'fail',\n 'pending',\n 'childRunner end'\n];\n\n// Until a suite has loaded, we assume this many tests in it.\nvar ESTIMATED_TESTS_PER_SUITE = 3;\n\n/**\n * A Mocha-like reporter that combines the output of multiple Mocha suites.\n *\n * @param {number} numSuites The number of suites that will be run, in order to\n * estimate the total number of tests that will be performed.\n * @param {!Array.} reporters The set of reporters that\n * should receive the unified event stream.\n * @param {MultiReporter} parent The parent reporter, if present.\n */\nexport default function MultiReporter(numSuites, reporters, parent) {\n this.reporters = reporters.map(function(reporter) {\n return new reporter(this);\n }.bind(this));\n\n this.parent = parent;\n this.basePath = parent && parent.basePath || util.basePath(window.location);\n\n this.total = numSuites * ESTIMATED_TESTS_PER_SUITE;\n // Mocha reporters assume a stream of events, so we have to be careful to only\n // report on one runner at a time...\n this.currentRunner = null;\n // ...while we buffer events for any other active runners.\n this.pendingEvents = [];\n\n this.emit('start');\n}\n\n/**\n * @param {!Location|string} location The location this reporter represents.\n * @return {!Mocha.reporters.Base} A reporter-like \"class\" for each child suite\n * that should be passed to `mocha.run`.\n */\nMultiReporter.prototype.childReporter = function childReporter(location) {\n var name = this.suiteTitle(location);\n // The reporter is used as a constructor, so we can't depend on `this` being\n // properly bound.\n var self = this;\n function reporter(runner) {\n runner.name = name;\n self.bindChildRunner(runner);\n }\n reporter.title = name;\n return reporter;\n};\n\n/** Must be called once all runners have finished. */\nMultiReporter.prototype.done = function done() {\n this.complete = true;\n this.flushPendingEvents();\n this.emit('end');\n};\n\n/**\n * Emit a top level test that is not part of any suite managed by this reporter.\n *\n * Helpful for reporting on global errors, loading issues, etc.\n *\n * @param {string} title The title of the test.\n * @param {*} opt_error An error associated with this test. If falsy, test is\n * considered to be passing.\n * @param {string} opt_suiteTitle Title for the suite that's wrapping the test.\n * @param {?boolean} opt_estimated If this test was included in the original\n * estimate of `numSuites`.\n */\nMultiReporter.prototype.emitOutOfBandTest = function emitOutOfBandTest(title, opt_error, opt_suiteTitle, opt_estimated) {\n util.debug('MultiReporter#emitOutOfBandTest(', arguments, ')');\n var root = new Mocha.Suite();\n root.title = opt_suiteTitle || '';\n var test = new Mocha.Test(title, function() {\n });\n test.parent = root;\n test.state = opt_error ? 'failed' : 'passed';\n test.err = opt_error;\n\n if (!opt_estimated) {\n this.total = this.total + ESTIMATED_TESTS_PER_SUITE;\n }\n\n var runner = {total: 1};\n this.proxyEvent('start', runner);\n this.proxyEvent('suite', runner, root);\n this.proxyEvent('test', runner, test);\n if (opt_error) {\n this.proxyEvent('fail', runner, test, opt_error);\n } else {\n this.proxyEvent('pass', runner, test);\n }\n this.proxyEvent('test end', runner, test);\n this.proxyEvent('suite end', runner, root);\n this.proxyEvent('end', runner);\n};\n\n/**\n * @param {!Location|string} location\n * @return {string}\n */\nMultiReporter.prototype.suiteTitle = function suiteTitle(location) {\n var path = util.relativeLocation(location, this.basePath);\n path = util.cleanLocation(path);\n return path;\n};\n\n// Internal Interface\n\n/** @param {!Mocha.runners.Base} runner The runner to listen to events for. */\nMultiReporter.prototype.bindChildRunner = function bindChildRunner(runner) {\n MOCHA_EVENTS.forEach(function(eventName) {\n runner.on(eventName, this.proxyEvent.bind(this, eventName, runner));\n }.bind(this));\n};\n\n/**\n * Evaluates an event fired by `runner`, proxying it forward or buffering it.\n *\n * @param {string} eventName\n * @param {!Mocha.runners.Base} runner The runner that emitted this event.\n * @param {...*} var_args Any additional data passed as part of the event.\n */\nMultiReporter.prototype.proxyEvent = function proxyEvent(eventName, runner, var_args) {\n var extraArgs = Array.prototype.slice.call(arguments, 2);\n if (this.complete) {\n console.warn('out of order Mocha event for ' + runner.name + ':', eventName, extraArgs);\n return;\n }\n\n if (this.currentRunner && runner !== this.currentRunner) {\n this.pendingEvents.push(arguments);\n return;\n }\n util.debug('MultiReporter#proxyEvent(', arguments, ')');\n\n // This appears to be a Mocha bug: Tests failed by passing an error to their\n // done function don't set `err` properly.\n //\n // TODO(nevir): Track down.\n if (eventName === 'fail' && !extraArgs[0].err) {\n extraArgs[0].err = extraArgs[1];\n }\n\n if (eventName === 'start') {\n this.onRunnerStart(runner);\n } else if (eventName === 'end') {\n this.onRunnerEnd(runner);\n } else {\n this.cleanEvent(eventName, runner, extraArgs);\n this.emit.apply(this, [eventName].concat(extraArgs));\n }\n};\n\n/**\n * Cleans or modifies an event if needed.\n *\n * @param {string} eventName\n * @param {!Mocha.runners.Base} runner The runner that emitted this event.\n * @param {!Array.<*>} extraArgs\n */\nMultiReporter.prototype.cleanEvent = function cleanEvent(eventName, runner, extraArgs) {\n // Suite hierarchy\n if (extraArgs[0]) {\n extraArgs[0] = this.showRootSuite(extraArgs[0]);\n }\n\n // Normalize errors\n if (eventName === 'fail') {\n extraArgs[1] = Stacky.normalize(extraArgs[1], STACKY_CONFIG);\n }\n if (extraArgs[0] && extraArgs[0].err) {\n extraArgs[0].err = Stacky.normalize(extraArgs[0].err, STACKY_CONFIG);\n }\n};\n\n/**\n * We like to show the root suite's title, which requires a little bit of\n * trickery in the suite hierarchy.\n *\n * @param {!Mocha.Runnable} node\n */\nMultiReporter.prototype.showRootSuite = function showRootSuite(node) {\n var leaf = node = Object.create(node);\n while (node && node.parent) {\n var wrappedParent = Object.create(node.parent);\n node.parent = wrappedParent;\n node = wrappedParent;\n }\n node.root = false;\n\n return leaf;\n};\n\n/** @param {!Mocha.runners.Base} runner */\nMultiReporter.prototype.onRunnerStart = function onRunnerStart(runner) {\n util.debug('MultiReporter#onRunnerStart:', runner.name);\n this.total = this.total - ESTIMATED_TESTS_PER_SUITE + runner.total;\n this.currentRunner = runner;\n};\n\n/** @param {!Mocha.runners.Base} runner */\nMultiReporter.prototype.onRunnerEnd = function onRunnerEnd(runner) {\n util.debug('MultiReporter#onRunnerEnd:', runner.name);\n this.currentRunner = null;\n this.flushPendingEvents();\n};\n\n/**\n * Flushes any buffered events and runs them through `proxyEvent`. This will\n * loop until all buffered runners are complete, or we have run out of buffered\n * events.\n */\nMultiReporter.prototype.flushPendingEvents = function flushPendingEvents() {\n var events = this.pendingEvents;\n this.pendingEvents = [];\n events.forEach(function(eventArgs) {\n this.proxyEvent.apply(this, eventArgs);\n }.bind(this));\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from '../util.js';\n\nvar ARC_OFFSET = 0; // start at the right.\nvar ARC_WIDTH = 6;\n\n/**\n * A Mocha reporter that updates the document's title and favicon with\n * at-a-glance stats.\n *\n * @param {!Mocha.Runner} runner The runner that is being reported on.\n */\nexport default function Title(runner) {\n Mocha.reporters.Base.call(this, runner);\n\n runner.on('test end', this.report.bind(this));\n}\n\n/** Reports current stats via the page title and favicon. */\nTitle.prototype.report = function report() {\n this.updateTitle();\n this.updateFavicon();\n};\n\n/** Updates the document title with a summary of current stats. */\nTitle.prototype.updateTitle = function updateTitle() {\n if (this.stats.failures > 0) {\n document.title = util.pluralizedStat(this.stats.failures, 'failing');\n } else {\n document.title = util.pluralizedStat(this.stats.passes, 'passing');\n }\n};\n\n/**\n * Draws an arc for the favicon status, relative to the total number of tests.\n *\n * @param {!CanvasRenderingContext2D} context\n * @param {number} total\n * @param {number} start\n * @param {number} length\n * @param {string} color\n */\nfunction drawFaviconArc(context, total, start, length, color) {\n var arcStart = ARC_OFFSET + Math.PI * 2 * (start / total);\n var arcEnd = ARC_OFFSET + Math.PI * 2 * ((start + length) / total);\n\n context.beginPath();\n context.strokeStyle = color;\n context.lineWidth = ARC_WIDTH;\n context.arc(16, 16, 16 - ARC_WIDTH / 2, arcStart, arcEnd);\n context.stroke();\n}\n\n/** Updates the document's favicon w/ a summary of current stats. */\nTitle.prototype.updateFavicon = function updateFavicon() {\n var canvas = document.createElement('canvas');\n canvas.height = canvas.width = 32;\n var context = canvas.getContext('2d');\n\n var passing = this.stats.passes;\n var pending = this.stats.pending;\n var failing = this.stats.failures;\n var total = Math.max(this.runner.total, passing + pending + failing);\n drawFaviconArc(context, total, 0, passing, '#0e9c57');\n drawFaviconArc(context, total, passing, pending, '#f3b300');\n drawFaviconArc(context, total, pending + passing, failing, '#ff5621');\n\n this.setFavicon(canvas.toDataURL());\n};\n\n/** Sets the current favicon by URL. */\nTitle.prototype.setFavicon = function setFavicon(url) {\n var current = document.head.querySelector('link[rel=\"icon\"]');\n if (current) {\n document.head.removeChild(current);\n }\n\n var link = document.createElement('link');\n link.rel = 'icon';\n link.type = 'image/x-icon';\n link.href = url;\n link.setAttribute('sizes', '32x32');\n document.head.appendChild(link);\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as suites from './suites.js';\nimport ConsoleReporter from './reporters/console.js';\nimport HTMLReporter from './reporters/html.js';\nimport MultiReporter from './reporters/multi.js';\nimport TitleReporter from './reporters/title.js';\n\nexport var htmlSuites = [];\nexport var jsSuites = [];\n\n/**\n * @param {CLISocket} socket The CLI socket, if present.\n * @param {MultiReporter} parent The parent reporter, if present.\n * @return {!Array. 0 || suites.jsSuites.length > 0) {\n reporters.push(HTMLReporter);\n }\n\n return reporters;\n}\n\n/**\n * Yeah, hideous, but this allows us to be loaded before Mocha, which is handy.\n */\nexport function injectMocha(Mocha) {\n _injectPrototype(ConsoleReporter, Mocha.reporters.Base.prototype);\n _injectPrototype(HTMLReporter, Mocha.reporters.HTML.prototype);\n // Mocha doesn't expose its `EventEmitter` shim directly, so:\n _injectPrototype(MultiReporter, Object.getPrototypeOf(Mocha.Runner.prototype));\n}\n\nfunction _injectPrototype(klass, prototype) {\n var newPrototype = Object.create(prototype);\n // Only support\n Object.keys(klass.prototype).forEach(function(key) {\n newPrototype[key] = klass.prototype[key];\n });\n\n klass.prototype = newPrototype;\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as config from './config.js';\nimport * as reporters from './reporters.js';\nimport * as util from './util.js';\n\n/**\n * Loads all environment scripts ...synchronously ...after us.\n */\nexport function loadSync() {\n util.debug('Loading environment scripts:');\n var a11ySuite = 'web-component-tester/data/a11ySuite.js';\n var scripts = config.get('environmentScripts');\n var a11ySuiteWillBeLoaded = window.__generatedByWct || scripts.indexOf(a11ySuite) > -1;\n if (!a11ySuiteWillBeLoaded) {\n // wct is running as a bower dependency, load a11ySuite from data/\n scripts.push(a11ySuite);\n }\n scripts.forEach(function(path) {\n var url = util.expandUrl(path, config.get('root'));\n util.debug('Loading environment script:', url);\n // Synchronous load.\n document.write(''); // jshint ignore:line\n });\n util.debug('Environment scripts loaded');\n\n var imports = config.get('environmentImports');\n imports.forEach(function(path) {\n var url = util.expandUrl(path, config.get('root'));\n util.debug('Loading environment import:', url);\n // Synchronous load.\n document.write(''); // jshint ignore:line\n });\n util.debug('Environment imports loaded');\n}\n\n/**\n * We have some hard dependencies on things that should be loaded via\n * `environmentScripts`, so we assert that they're present here; and do any\n * post-facto setup.\n */\nexport function ensureDependenciesPresent() {\n _ensureMocha();\n _checkChai();\n}\n\nfunction _ensureMocha() {\n var Mocha = window.Mocha;\n if (!Mocha) {\n throw new Error('WCT requires Mocha. Please ensure that it is present in WCT.environmentScripts, or that you load it before loading web-component-tester/browser.js');\n }\n reporters.injectMocha(Mocha);\n // Magic loading of mocha's stylesheet\n var mochaPrefix = util.scriptPrefix('mocha.js');\n // only load mocha stylesheet for the test runner output\n // Not the end of the world, if it doesn't load.\n if (mochaPrefix && window.top === window.self) {\n util.loadStyle(mochaPrefix + 'mocha.css');\n }\n}\n\nfunction _checkChai() {\n if (!window.chai) {\n util.debug('Chai not present; not registering shorthands');\n return;\n }\n\n window.assert = window.chai.assert;\n window.expect = window.chai.expect;\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as config from '../config.js';\n\n// We may encounter errors during initialization (for example, syntax errors in\n// a test file). Hang onto those (and more) until we are ready to report them.\nexport var globalErrors = [];\n\n/**\n * Hook the environment to pick up on global errors.\n */\nexport function listenForErrors() {\n window.addEventListener('error', function(event) {\n globalErrors.push(event.error);\n });\n\n // Also, we treat `console.error` as a test failure. Unless you prefer not.\n var origConsole = console;\n var origError = console.error;\n console.error = function wctShimmedError() {\n origError.apply(origConsole, arguments);\n if (config.get('trackConsoleError')) {\n throw 'console.error: ' + Array.prototype.join.call(arguments, ' ');\n }\n };\n}\n","\nvar interfaceExtensions = [];\n\n/**\n * Registers an extension that extends the global `Mocha` implementation\n * with new helper methods. These helper methods will be added to the `window`\n * when tests run for both BDD and TDD interfaces.\n */\nexport function extendInterfaces(helperName, helperFactory) {\n interfaceExtensions.push(function() {\n var Mocha = window.Mocha;\n // For all Mocha interfaces (probably just TDD and BDD):\n Object.keys(Mocha.interfaces).forEach(function(interfaceName) {\n // This is the original callback that defines the interface (TDD or BDD):\n var originalInterface = Mocha.interfaces[interfaceName];\n // This is the name of the \"teardown\" or \"afterEach\" property for the\n // current interface:\n var teardownProperty = interfaceName === 'tdd' ? 'teardown' : 'afterEach';\n // The original callback is monkey patched with a new one that appends to\n // the global context however we want it to:\n Mocha.interfaces[interfaceName] = function(suite) {\n // Call back to the original callback so that we get the base interface:\n originalInterface.apply(this, arguments);\n // Register a listener so that we can further extend the base interface:\n suite.on('pre-require', function(context, file, mocha) {\n // Capture a bound reference to the teardown function as a convenience:\n var teardown = context[teardownProperty].bind(context);\n // Add our new helper to the testing context. The helper is generated\n // by a factory method that receives the context, the teardown function\n // and the interface name and returns the new method to be added to\n // that context:\n context[helperName] = helperFactory(context, teardown, interfaceName);\n });\n };\n });\n });\n}\n\n/**\n * Applies any registered interface extensions. The extensions will be applied\n * as many times as this function is called, so don't call it more than once.\n */\nexport function applyExtensions() {\n interfaceExtensions.forEach(function(applyExtension) {\n applyExtension();\n });\n}\n","import { extendInterfaces } from './extend';\n\nextendInterfaces('fixture', function(context, teardown) {\n\n // Return context.fixture if it is already a thing, for backwards\n // compatibility with `test-fixture-mocha.js`:\n return context.fixture || function fixture(fixtureId, model) {\n\n // Automatically register a teardown callback that will restore the\n // test-fixture:\n teardown(function() {\n document.getElementById(fixtureId).restore();\n });\n\n // Find the test-fixture with the provided ID and create it, returning\n // the results:\n return document.getElementById(fixtureId).create(model);\n };\n});\n","import { extendInterfaces } from './extend';\n\n/**\n * stub\n *\n * The stub addon allows the tester to partially replace the implementation of\n * an element with some custom implementation. Usage example:\n *\n * beforeEach(function() {\n * stub('x-foo', {\n * attached: function() {\n * // Custom implementation of the `attached` method of element `x-foo`..\n * },\n * otherMethod: function() {\n * // More custom implementation..\n * },\n * // etc..\n * });\n * });\n */\nextendInterfaces('stub', function(context, teardown) {\n\n return function stub(tagName, implementation) {\n // Find the prototype of the element being stubbed:\n var proto = document.createElement(tagName).constructor.prototype;\n\n // For all keys in the implementation to stub with..\n var keys = Object.keys(implementation);\n keys.forEach(function(key) {\n // Stub the method on the element prototype with Sinon:\n sinon.stub(proto, key, implementation[key]);\n });\n\n // After all tests..\n teardown(function() {\n // For all of the keys in the implementation we stubbed..\n keys.forEach(function(key) {\n // Restore the stub:\n if (proto[key].isSinonProxy) {\n proto[key].restore();\n }\n });\n });\n };\n});\n","import { extendInterfaces } from './extend';\n\n// replacement map stores what should be\nvar replacements = {};\n\n/**\n * replace\n *\n * The replace addon allows the tester to replace all usages of one element with\n * another element within all Polymer elements created within the time span of\n * the test. Usage example:\n *\n * beforeEach(function() {\n * replace('x-foo').with('x-fake-foo');\n * });\n *\n * All annotations and attributes will be set on the placement element the way\n * they were set for the original element.\n */\nextendInterfaces('replace', function(context, teardown) {\n return function replace(oldTagName) {\n return {\n with: function(tagName) {\n // Standardizes our replacements map\n oldTagName = oldTagName.toLowerCase();\n tagName = tagName.toLowerCase();\n\n replacements[oldTagName] = tagName;\n\n // If the function is already a stub, restore it to original\n if (Polymer.Base.instanceTemplate.isSinonProxy) {\n return;\n }\n\n // Use Sinon to stub `Polymer.Base.instanceTemplate`:\n sinon.stub(Polymer.Base, 'instanceTemplate', function(template) {\n // dom to be replaced. _content is used for templatize calls the\n // content is used for every other occasion of template instantiation\n var dom = template._content || template.content;\n var templateNode = dom;\n var instanceNode;\n var instanceParent;\n\n // Traverses the tree. And places the new nodes (after replacing) into\n // a new template.\n while (templateNode) {\n if (templateNode.nodeType === Node.ELEMENT_NODE) {\n var originalTagName = templateNode.tagName.toLowerCase();\n var currentTagName = originalTagName;\n\n // determines the name of the element in the new template\n while (replacements.hasOwnProperty(currentTagName)) {\n currentTagName = replacements[currentTagName];\n }\n\n // if we have not changed this element, copy it over\n if (currentTagName === originalTagName) {\n instanceNode = document.importNode(templateNode);\n\n } else {\n // create the new node\n instanceNode = document.createElement(currentTagName);\n\n var numAttributes = templateNode.attributes.length;\n // For all attributes in the original node..\n for (var index=0; index} The titles of the runnable and its parents.\n */\nfunction getTitles(runnable) {\n var titles = [];\n while (runnable && !runnable.root && runnable.title) {\n titles.unshift(runnable.title);\n runnable = runnable.parent;\n }\n return titles;\n}\n\n/**\n * @param {!Mocha.Runnable} runnable\n * @return {string}\n */\nfunction getState(runnable) {\n if (runnable.state === 'passed') {\n return 'passing';\n } else if (runnable.state == 'failed') {\n return 'failing';\n } else if (runnable.pending) {\n return 'pending';\n } else {\n return 'unknown';\n }\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n// Make sure that we use native timers, in case they're being stubbed out.\nvar setInterval = window.setInterval; // jshint ignore:line\nvar setTimeout = window.setTimeout; // jshint ignore:line\nvar requestAnimationFrame = window.requestAnimationFrame; // jshint ignore:line\n\n/**\n * Runs `stepFn`, catching any error and passing it to `callback` (Node-style).\n * Otherwise, calls `callback` with no arguments on success.\n *\n * @param {function()} callback\n * @param {function()} stepFn\n */\nwindow.safeStep = function safeStep(callback, stepFn) {\n var err;\n try {\n stepFn();\n } catch (error) {\n err = error;\n }\n callback(err);\n};\n\n/**\n * Runs your test at declaration time (before Mocha has begun tests). Handy for\n * when you need to test document initialization.\n *\n * Be aware that any errors thrown asynchronously cannot be tied to your test.\n * You may want to catch them and pass them to the done event, instead. See\n * `safeStep`.\n *\n * @param {string} name The name of the test.\n * @param {function(?function())} testFn The test function. If an argument is\n * accepted, the test will be treated as async, just like Mocha tests.\n */\nwindow.testImmediate = function testImmediate(name, testFn) {\n if (testFn.length > 0) {\n return testImmediateAsync(name, testFn);\n }\n\n var err;\n try {\n testFn();\n } catch (error) {\n err = error;\n }\n\n test(name, function(done) {\n done(err);\n });\n};\n\n/**\n * An async-only variant of `testImmediate`.\n *\n * @param {string} name\n * @param {function(?function())} testFn\n */\nwindow.testImmediateAsync = function testImmediateAsync(name, testFn) {\n var testComplete = false;\n var err;\n\n test(name, function(done) {\n var intervalId = setInterval(function() {\n if (!testComplete) return;\n clearInterval(intervalId);\n done(err);\n }, 10);\n });\n\n try {\n testFn(function(error) {\n if (error) err = error;\n testComplete = true;\n });\n } catch (error) {\n err = error;\n testComplete = true;\n }\n};\n\n/**\n * Triggers a flush of any pending events, observations, etc and calls you back\n * after they have been processed.\n *\n * @param {function()} callback\n */\nwindow.flush = function flush(callback) {\n // Ideally, this function would be a call to Polymer.dom.flush, but that doesn't\n // support a callback yet (https://github.com/Polymer/polymer-dev/issues/851),\n // ...and there's cross-browser flakiness to deal with.\n\n // Make sure that we're invoking the callback with no arguments so that the\n // caller can pass Mocha callbacks, etc.\n var done = function done() { callback(); };\n\n // Because endOfMicrotask is flaky for IE, we perform microtask checkpoints\n // ourselves (https://github.com/Polymer/polymer-dev/issues/114):\n var isIE = navigator.appName == 'Microsoft Internet Explorer';\n if (isIE && window.Platform && window.Platform.performMicrotaskCheckpoint) {\n var reallyDone = done;\n done = function doneIE() {\n Platform.performMicrotaskCheckpoint();\n setTimeout(reallyDone, 0);\n };\n }\n\n // Everyone else gets a regular flush.\n var scope;\n if (window.Polymer && window.Polymer.dom && window.Polymer.dom.flush) {\n scope = window.Polymer.dom;\n } else if (window.Polymer && window.Polymer.flush) {\n scope = window.Polymer;\n } else if (window.WebComponents && window.WebComponents.flush) {\n scope = window.WebComponents;\n }\n if (scope) {\n scope.flush();\n }\n\n // Ensure that we are creating a new _task_ to allow all active microtasks to\n // finish (the code you're testing may be using endOfMicrotask, too).\n setTimeout(done, 0);\n};\n\n/**\n * Advances a single animation frame.\n *\n * Calls `flush`, `requestAnimationFrame`, `flush`, and `callback` sequentially\n * @param {function()} callback\n */\nwindow.animationFrameFlush = function animationFrameFlush(callback) {\n flush(function() {\n requestAnimationFrame(function() {\n flush(callback);\n });\n });\n};\n\n/**\n * DEPRECATED: Use `flush`.\n * @param {function} callback\n */\nwindow.asyncPlatformFlush = function asyncPlatformFlush(callback) {\n console.warn('asyncPlatformFlush is deprecated in favor of the more terse flush()');\n return window.flush(callback);\n};\n\n/**\n *\n */\nwindow.waitFor = function waitFor(fn, next, intervalOrMutationEl, timeout, timeoutTime) {\n timeoutTime = timeoutTime || Date.now() + (timeout || 1000);\n intervalOrMutationEl = intervalOrMutationEl || 32;\n try {\n fn();\n } catch (e) {\n if (Date.now() > timeoutTime) {\n throw e;\n } else {\n if (isNaN(intervalOrMutationEl)) {\n intervalOrMutationEl.onMutation(intervalOrMutationEl, function() {\n waitFor(fn, next, intervalOrMutationEl, timeout, timeoutTime);\n });\n } else {\n setTimeout(function() {\n waitFor(fn, next, intervalOrMutationEl, timeout, timeoutTime);\n }, intervalOrMutationEl);\n }\n return;\n }\n }\n next();\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n/**\n * This file is the entry point into `web-component-tester`'s browser client.\n */\nimport * as config from './config.js';\nimport * as environment from './environment.js';\nimport * as errors from './environment/errors.js';\nimport * as mocha from './mocha';\nimport * as reporters from './reporters';\nimport * as suites from './suites.js';\nimport * as util from './util.js';\nimport CLISocket from './clisocket.js';\nimport ChildRunner from './childrunner.js';\nimport MultiReporter from './reporters/multi.js';\n// Registers a bunch of globals:\nimport './environment/helpers.js';\n\n// You can configure WCT before it has loaded by assigning your custom\n// configuration to the global `WCT`.\nconfig.setup(window.WCT);\n\n// Maybe some day we'll expose WCT as a module to whatever module registry you\n// are using (aka the UMD approach), or as an es6 module.\nvar WCT = window.WCT = {};\n// A generic place to hang data about the current suite. This object is reported\n// back via the `sub-suite-start` and `sub-suite-end` events.\nWCT.share = {};\n// Until then, we get to rely on it to expose parent runners to their children.\nWCT._ChildRunner = ChildRunner;\nWCT._config = config._config;\n\n\n// Public Interface\n\n/**\n * Loads suites of tests, supporting both `.js` and `.html` files.\n *\n * @param {!Array.} files The files to load.\n */\nWCT.loadSuites = suites.loadSuites;\n\n\n// Load Process\n\nerrors.listenForErrors();\nmocha.stubInterfaces();\nenvironment.loadSync();\n\n// Give any scripts on the page a chance to declare tests and muck with things.\ndocument.addEventListener('DOMContentLoaded', function() {\n util.debug('DOMContentLoaded');\n\n environment.ensureDependenciesPresent();\n\n // We need the socket built prior to building its reporter.\n CLISocket.init(function(error, socket) {\n if (error) throw error;\n\n // Are we a child of another run?\n var current = ChildRunner.current();\n var parent = current && current.parentScope.WCT._reporter;\n util.debug('parentReporter:', parent);\n\n var childSuites = suites.activeChildSuites();\n var reportersToUse = reporters.determineReporters(socket, parent);\n // +1 for any local tests.\n var reporter = new MultiReporter(childSuites.length + 1, reportersToUse, parent);\n WCT._reporter = reporter; // For environment/compatibility.js\n\n // We need the reporter so that we can report errors during load.\n suites.loadJsSuites(reporter, function(error) {\n // Let our parent know that we're about to start the tests.\n if (current) current.ready(error);\n if (error) throw error;\n\n // Emit any errors we've encountered up til now\n errors.globalErrors.forEach(function onError(error) {\n reporter.emitOutOfBandTest('Test Suite Initialization', error);\n });\n\n suites.runSuites(reporter, childSuites, function(error) {\n // Make sure to let our parent know that we're done.\n if (current) current.done();\n if (error) throw error;\n });\n });\n });\n});\n"],"names":["config.get","util.paramsToQuery","util.getParams","util.mergeParams","util.parseUrl","util.debug","util.basePath","util.scriptPrefix","htmlSuites","jsSuites","util.getParam","util.cleanLocation","util.parallel","util.loadScript","util.whenFrameworksReady","console","util.pluralizedStat","util.relativeLocation","HTMLReporter","suites.jsSuites","suites.htmlSuites","ConsoleReporter","TitleReporter","util.expandUrl","util.loadStyle","reporters.injectMocha","setTimeout","config.setup","config._config","suites.loadSuites","errors.listenForErrors","mocha.stubInterfaces","environment.loadSync","suites.runSuites","errors.globalErrors","suites.loadJsSuites","reporters.determineReporters","suites.activeChildSuites","environment.ensureDependenciesPresent"],"mappings":";;;;;;;;;;;;;AAYA;;;;AAIA,AAAO,SAAS,mBAAmB,CAAC,QAAQ,EAAE;EAC5C,KAAK,CAAC,qBAAqB,CAAC,CAAC;EAC7B,IAAI,IAAI,GAAG,WAAW;IACpB,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAClC,QAAQ,EAAE,CAAC;GACZ,CAAC;;EAEF,SAAS,sBAAsB,GAAG;IAChC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC7B,IAAI,MAAM,CAAC,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE;MACnD,aAAa,CAAC,SAAS,CAAC,WAAW;QACjC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC7B,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AAQ,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACjF,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC;;;IAGzBD,YAAmB,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE;;MAE5C,IAAI,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;MAClC,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC;;;MAGvBD,YAAmB,CAAC,OAAO,CAAC,SAAS,OAAO,CAAC,KAAK,EAAE;QAClD,QAAQ,CAAC,iBAAiB,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;OAChE,CAAC,CAAC;;MAEHD,SAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,KAAK,EAAE;;QAEtD,IAAI,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC;OACxB,CAAC,CAAC;KACJ,CAAC,CAAC;GACJ,CAAC,CAAC;CACJ,CAAC,CAAC,;;"} \ No newline at end of file +{"version":3,"file":"browser.js.map","sources":["browser/util.js","browser/childrunner.js","browser/config.js","browser/suites.js","browser/reporters/console.js","browser/reporters/html.js","browser/reporters/multi.js","browser/reporters/title.js","browser/reporters.js","browser/environment.js","browser/environment/errors.js","browser/mocha/extend.js","browser/mocha/fixture.js","browser/mocha/stub.js","browser/mocha/replace.js","browser/mocha.js","browser/clisocket.js","browser/environment/helpers.js","browser/index.js"],"sourcesContent":["/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport * as config from './config.js';\n\n/**\n * @param {function()} callback A function to call when the active web component\n * frameworks have loaded.\n */\nexport function whenFrameworksReady(callback) {\n debug('whenFrameworksReady');\n var done = function() {\n debug('whenFrameworksReady done');\n callback();\n };\n\n function whenWebComponentsReady() {\n debug('WebComponentsReady?');\n if (window.WebComponents && WebComponents.whenReady) {\n WebComponents.whenReady(function() {\n debug('WebComponents Ready');\n done();\n });\n } else {\n var after = function after() {\n window.removeEventListener('WebComponentsReady', after);\n debug('WebComponentsReady');\n done();\n };\n window.addEventListener('WebComponentsReady', after);\n }\n }\n\n function importsReady() {\n // handle Polymer 0.5 readiness\n debug('Polymer ready?');\n if (window.Polymer && Polymer.whenReady) {\n Polymer.whenReady(function() {\n debug('Polymer ready');\n done();\n });\n } else {\n whenWebComponentsReady();\n }\n }\n\n // All our supported framework configurations depend on imports.\n if (!window.HTMLImports) {\n done();\n } else if (HTMLImports.ready) {\n debug('HTMLImports ready');\n importsReady();\n } else if (HTMLImports.whenReady) {\n HTMLImports.whenReady(function() {\n debug('HTMLImports.whenReady ready');\n importsReady();\n });\n } else {\n whenWebComponentsReady();\n }\n}\n\n/**\n * @param {number} count\n * @param {string} kind\n * @return {string} ' tests' or ' test'.\n */\nexport function pluralizedStat(count, kind) {\n if (count === 1) {\n return count + ' ' + kind + ' test';\n } else {\n return count + ' ' + kind + ' tests';\n }\n}\n\n/**\n * @param {string} path The URI of the script to load.\n * @param {function} done\n */\nexport function loadScript(path, done) {\n var script = document.createElement('script');\n script.src = path;\n if (done) {\n script.onload = done.bind(null, null);\n script.onerror = done.bind(null, 'Failed to load script ' + script.src);\n }\n document.head.appendChild(script);\n}\n\n/**\n * @param {string} path The URI of the stylesheet to load.\n * @param {function} done\n */\nexport function loadStyle(path, done) {\n var link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = path;\n if (done) {\n link.onload = done.bind(null, null);\n link.onerror = done.bind(null, 'Failed to load stylesheet ' + link.href);\n }\n document.head.appendChild(link);\n}\n\n/**\n * @param {...*} var_args Logs values to the console when the `debug`\n * configuration option is true.\n */\nexport function debug(var_args) {\n if (!config.get('verbose')) return;\n var args = [window.location.pathname];\n args.push.apply(args, arguments);\n (console.debug || console.log).apply(console, args);\n}\n\n// URL Processing\n\n/**\n * @param {string} url\n * @return {{base: string, params: string}}\n */\nexport function parseUrl(url) {\n var parts = url.match(/^(.*?)(?:\\?(.*))?$/);\n return {\n base: parts[1],\n params: getParams(parts[2] || ''),\n };\n}\n\n/**\n * Expands a URL that may or may not be relative to `base`.\n *\n * @param {string} url\n * @param {string} base\n * @return {string}\n */\nexport function expandUrl(url, base) {\n if (!base) return url;\n if (url.match(/^(\\/|https?:\\/\\/)/)) return url;\n if (base.substr(base.length - 1) !== '/') {\n base = base + '/';\n }\n return base + url;\n}\n\n/**\n * @param {string=} opt_query A query string to parse.\n * @return {!Object>} All params on the URL's query.\n */\nexport function getParams(opt_query) {\n var query = typeof opt_query === 'string' ? opt_query : window.location.search;\n if (query.substring(0, 1) === '?') {\n query = query.substring(1);\n }\n // python's SimpleHTTPServer tacks a `/` on the end of query strings :(\n if (query.slice(-1) === '/') {\n query = query.substring(0, query.length - 1);\n }\n if (query === '') return {};\n\n var result = {};\n query.split('&').forEach(function(part) {\n var pair = part.split('=');\n if (pair.length !== 2) {\n console.warn('Invalid URL query part:', part);\n return;\n }\n var key = decodeURIComponent(pair[0]);\n var value = decodeURIComponent(pair[1]);\n\n if (!result[key]) {\n result[key] = [];\n }\n result[key].push(value);\n });\n\n return result;\n}\n\n/**\n * Merges params from `source` into `target` (mutating `target`).\n *\n * @param {!Object>} target\n * @param {!Object>} source\n */\nexport function mergeParams(target, source) {\n Object.keys(source).forEach(function(key) {\n if (!(key in target)) {\n target[key] = [];\n }\n target[key] = target[key].concat(source[key]);\n });\n}\n\n/**\n * @param {string} param The param to return a value for.\n * @return {?string} The first value for `param`, if found.\n */\nexport function getParam(param) {\n var params = getParams();\n return params[param] ? params[param][0] : null;\n}\n\n/**\n * @param {!Object>} params\n * @return {string} `params` encoded as a URI query.\n */\nexport function paramsToQuery(params) {\n var pairs = [];\n Object.keys(params).forEach(function(key) {\n params[key].forEach(function(value) {\n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n });\n });\n return (pairs.length > 0) ? ('?' + pairs.join('&')) : '';\n}\n\n/**\n * @param {!Location|string} location\n * @return {string}\n */\nexport function basePath(location) {\n return (location.pathname || location).match(/^.*\\//)[0];\n}\n\n/**\n * @param {!Location|string} location\n * @param {string} basePath\n * @return {string}\n */\nexport function relativeLocation(location, basePath) {\n var path = location.pathname || location;\n if (path.indexOf(basePath) === 0) {\n path = path.substring(basePath.length);\n }\n return path;\n}\n\n/**\n * @param {!Location|string} location\n * @return {string}\n */\nexport function cleanLocation(location) {\n var path = location.pathname || location;\n if (path.slice(-11) === '/index.html') {\n path = path.slice(0, path.length - 10);\n }\n return path;\n}\n\n/**\n * Like `async.parallelLimit`, but our own so that we don't force a dependency\n * on downstream code.\n *\n * @param {!Array} runners Runners that call their given\n * Node-style callback when done.\n * @param {number|function(*)} limit Maximum number of concurrent runners.\n * (optional).\n * @param {?function(*)} done Callback that should be triggered once all runners\n * have completed, or encountered an error.\n */\nexport function parallel(runners, limit, done) {\n if (typeof limit !== 'number') {\n done = limit;\n limit = 0;\n }\n if (!runners.length) return done();\n\n var called = false;\n var total = runners.length;\n var numActive = 0;\n var numDone = 0;\n\n function runnerDone(error) {\n if (called) return;\n numDone = numDone + 1;\n numActive = numActive - 1;\n\n if (error || numDone >= total) {\n called = true;\n done(error);\n } else {\n runOne();\n }\n }\n\n function runOne() {\n if (limit && numActive >= limit) return;\n if (!runners.length) return;\n numActive = numActive + 1;\n runners.shift()(runnerDone);\n }\n runners.forEach(runOne);\n}\n\n/**\n * Finds the directory that a loaded script is hosted on.\n *\n * @param {string} filename\n * @return {string?}\n */\nexport function scriptPrefix(filename) {\n var scripts = document.querySelectorAll('script[src*=\"' + filename + '\"]');\n if (scripts.length !== 1) return null;\n var script = scripts[0].src;\n return script.substring(0, script.indexOf(filename));\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from './util.js';\n\n// TODO(thedeeno): Consider renaming subsuite. IIRC, childRunner is entirely\n// distinct from mocha suite, which tripped me up badly when trying to add\n// plugin support. Perhaps something like 'batch', or 'bundle'. Something that\n// has no mocha correlate. This may also eliminate the need for root/non-root\n// suite distinctions.\n\n/**\n * A Mocha suite (or suites) run within a child iframe, but reported as if they\n * are part of the current context.\n */\nexport default function ChildRunner(url, parentScope) {\n var urlBits = util.parseUrl(url);\n util.mergeParams(\n urlBits.params, util.getParams(parentScope.location.search));\n delete urlBits.params.cli_browser_id;\n\n this.url = urlBits.base + util.paramsToQuery(urlBits.params);\n this.parentScope = parentScope;\n\n this.state = 'initializing';\n}\n\n// ChildRunners get a pretty generous load timeout by default.\nChildRunner.loadTimeout = 60000;\n\n// We can't maintain properties on iframe elements in Firefox/Safari/???, so we\n// track childRunners by URL.\nChildRunner._byUrl = {};\n\n/**\n * @return {ChildRunner} The `ChildRunner` that was registered for this window.\n */\nChildRunner.current = function() {\n return ChildRunner.get(window);\n};\n\n/**\n * @param {!Window} target A window to find the ChildRunner of.\n * @param {boolean} traversal Whether this is a traversal from a child window.\n * @return {ChildRunner} The `ChildRunner` that was registered for `target`.\n */\nChildRunner.get = function(target, traversal) {\n var childRunner = ChildRunner._byUrl[target.location.href];\n if (childRunner) return childRunner;\n if (window.parent === window) { // Top window.\n if (traversal) {\n console.warn('Subsuite loaded but was never registered. This most likely is due to wonky history behavior. Reloading...');\n window.location.reload();\n }\n return null;\n }\n // Otherwise, traverse.\n return window.parent.WCT._ChildRunner.get(target, true);\n};\n\n/**\n * Loads and runs the subsuite.\n *\n * @param {function} done Node-style callback.\n */\nChildRunner.prototype.run = function(done) {\n util.debug('ChildRunner#run', this.url);\n this.state = 'loading';\n this.onRunComplete = done;\n\n this.iframe = document.createElement('iframe');\n this.iframe.src = this.url;\n this.iframe.classList.add('subsuite');\n\n var container = document.getElementById('subsuites');\n if (!container) {\n container = document.createElement('div');\n container.id = 'subsuites';\n document.body.appendChild(container);\n }\n container.appendChild(this.iframe);\n\n // let the iframe expand the URL for us.\n this.url = this.iframe.src;\n ChildRunner._byUrl[this.url] = this;\n\n this.timeoutId = setTimeout(\n this.loaded.bind(this, new Error('Timed out loading ' + this.url)), ChildRunner.loadTimeout);\n\n this.iframe.addEventListener('error',\n this.loaded.bind(this, new Error('Failed to load document ' + this.url)));\n\n this.iframe.contentWindow.addEventListener('DOMContentLoaded', this.loaded.bind(this, null));\n};\n\n/**\n * Called when the sub suite's iframe has loaded (or errored during load).\n *\n * @param {*} error The error that occured, if any.\n */\nChildRunner.prototype.loaded = function(error) {\n util.debug('ChildRunner#loaded', this.url, error);\n\n // Not all targets have WCT loaded (compatiblity mode)\n if (this.iframe.contentWindow.WCT) {\n this.share = this.iframe.contentWindow.WCT.share;\n }\n\n if (error) {\n this.signalRunComplete(error);\n this.done();\n }\n};\n\n/**\n * Called in mocha/run.js when all dependencies have loaded, and the child is\n * ready to start running tests\n *\n * @param {*} error The error that occured, if any.\n */\nChildRunner.prototype.ready = function(error) {\n util.debug('ChildRunner#ready', this.url, error);\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n if (error) {\n this.signalRunComplete(error);\n this.done();\n }\n};\n\n/** Called when the sub suite's tests are complete, so that it can clean up. */\nChildRunner.prototype.done = function done() {\n util.debug('ChildRunner#done', this.url, arguments);\n\n // make sure to clear that timeout\n this.ready();\n this.signalRunComplete();\n\n if (!this.iframe) return;\n // Be safe and avoid potential browser crashes when logic attempts to interact\n // with the removed iframe.\n setTimeout(function() {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }.bind(this), 1);\n};\n\nChildRunner.prototype.signalRunComplete = function signalRunComplete(error) {\n if (!this.onRunComplete) return;\n this.state = 'complete';\n this.onRunComplete(error);\n this.onRunComplete = null;\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from './util.js';\nimport ChildRunner from './childrunner.js';\n\n/**\n * The global configuration state for WCT's browser client.\n */\nexport var _config = {\n /**\n * `.js` scripts to be loaded (synchronously) before WCT starts in earnest.\n *\n * Paths are relative to `scriptPrefix`.\n */\n environmentScripts: [\n 'stacky/browser.js',\n 'async/lib/async.js',\n 'lodash/lodash.js',\n 'mocha/mocha.js',\n 'chai/chai.js',\n 'sinonjs/sinon.js',\n 'sinon-chai/lib/sinon-chai.js',\n 'accessibility-developer-tools/dist/js/axs_testing.js'\n ],\n\n environmentImports: [\n 'test-fixture/test-fixture.html'\n ],\n\n /** Absolute root for client scripts. Detected in `setup()` if not set. */\n root: null,\n\n /** By default, we wait for any web component frameworks to load. */\n waitForFrameworks: true,\n\n /** Alternate callback for waiting for tests.\n * `this` for the callback will be the window currently running tests.\n */\n waitFor: null,\n\n /** How many `.html` suites that can be concurrently loaded & run. */\n numConcurrentSuites: 1,\n\n /** Whether `console.error` should be treated as a test failure. */\n trackConsoleError: true,\n\n /** Configuration passed to mocha.setup. */\n mochaOptions: {\n timeout: 10 * 1000\n },\n\n /** Whether WCT should emit (extremely verbose) debugging log messages. */\n verbose: false,\n};\n\n/**\n * Merges initial `options` into WCT's global configuration.\n *\n * @param {Object} options The options to merge. See `browser/config.js` for a\n * reference.\n */\nexport function setup(options) {\n var childRunner = ChildRunner.current();\n if (childRunner) {\n _deepMerge(_config, childRunner.parentScope.WCT._config);\n // But do not force the mocha UI\n delete _config.mochaOptions.ui;\n }\n\n if (options && typeof options === 'object') {\n _deepMerge(_config, options);\n }\n\n if (!_config.root) {\n // Sibling dependencies.\n var root = util.scriptPrefix('browser.js');\n _config.root = util.basePath(root.substr(0, root.length - 1));\n if (!_config.root) {\n throw new Error('Unable to detect root URL for WCT sources. Please set WCT.root before including browser.js');\n }\n }\n}\n\n/**\n * Retrieves a configuration value.\n *\n * @param {string} key\n * @return {*}\n */\nexport function get(key) {\n return _config[key];\n}\n\n// Internal\n\nfunction _deepMerge(target, source) {\n Object.keys(source).forEach(function(key) {\n if (target[key] !== null && typeof target[key] === 'object' && !Array.isArray(target[key])) {\n _deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as config from './config.js';\nimport * as util from './util.js';\nimport ChildRunner from './childrunner.js';\n\nexport var htmlSuites = [];\nexport var jsSuites = [];\n\n// We process grep ourselves to avoid loading suites that will be filtered.\nvar GREP = util.getParam('grep');\n// work around mocha bug (https://github.com/mochajs/mocha/issues/2070)\nif (GREP) {\n GREP = GREP.replace(/\\\\\\./g, '.');\n}\n\n/**\n * Loads suites of tests, supporting both `.js` and `.html` files.\n *\n * @param {!Array.} files The files to load.\n */\nexport function loadSuites(files) {\n files.forEach(function(file) {\n if (/\\.js(\\?.*)?$/.test(file)) {\n jsSuites.push(file);\n } else if (/\\.html(\\?.*)?$/.test(file)) {\n htmlSuites.push(file);\n } else {\n throw new Error('Unknown resource type: ' + file);\n }\n });\n}\n\n/**\n * @return {!Array.} The child suites that should be loaded, ignoring\n * those that would not match `GREP`.\n */\nexport function activeChildSuites() {\n var subsuites = htmlSuites;\n if (GREP) {\n var cleanSubsuites = [];\n for (var i = 0, subsuite; subsuite = subsuites[i]; i++) {\n if (GREP.indexOf(util.cleanLocation(subsuite)) !== -1) {\n cleanSubsuites.push(subsuite);\n }\n }\n subsuites = cleanSubsuites;\n }\n return subsuites;\n}\n\n/**\n * Loads all `.js` sources requested by the current suite.\n *\n * @param {!MultiReporter} reporter\n * @param {function} done\n */\nexport function loadJsSuites(reporter, done) {\n util.debug('loadJsSuites', jsSuites);\n\n var loaders = jsSuites.map(function(file) {\n // We only support `.js` dependencies for now.\n return util.loadScript.bind(util, file);\n });\n\n util.parallel(loaders, done);\n}\n\n/**\n * @param {!MultiReporter} reporter\n * @param {!Array.} childSuites\n * @param {function} done\n */\nexport function runSuites(reporter, childSuites, done) {\n util.debug('runSuites');\n\n var suiteRunners = [\n // Run the local tests (if any) first, not stopping on error;\n _runMocha.bind(null, reporter),\n ];\n\n // As well as any sub suites. Again, don't stop on error.\n childSuites.forEach(function(file) {\n suiteRunners.push(function(next) {\n var childRunner = new ChildRunner(file, window);\n reporter.emit('childRunner start', childRunner);\n childRunner.run(function(error) {\n reporter.emit('childRunner end', childRunner);\n if (error) reporter.emitOutOfBandTest(file, error);\n next();\n });\n });\n });\n\n util.parallel(suiteRunners, config.get('numConcurrentSuites'), function(error) {\n reporter.done();\n done(error);\n });\n}\n\n/**\n * Kicks off a mocha run, waiting for frameworks to load if necessary.\n *\n * @param {!MultiReporter} reporter Where to send Mocha's events.\n * @param {function} done A callback fired, _no error is passed_.\n */\nfunction _runMocha(reporter, done, waited) {\n if (config.get('waitForFrameworks') && !waited) {\n var waitFor = (config.get('waitFor') || util.whenFrameworksReady).bind(window);\n waitFor(_runMocha.bind(null, reporter, done, true));\n return;\n }\n util.debug('_runMocha');\n var mocha = window.mocha;\n var Mocha = window.Mocha;\n\n mocha.reporter(reporter.childReporter(window.location));\n mocha.suite.title = reporter.suiteTitle(window.location);\n mocha.grep(GREP);\n\n // We can't use `mocha.run` because it bashes over grep, invert, and friends.\n // See https://github.com/visionmedia/mocha/blob/master/support/tail.js#L137\n var runner = Mocha.prototype.run.call(mocha, function(error) {\n if (document.getElementById('mocha')) {\n Mocha.utils.highlightTags('code');\n }\n done(); // We ignore the Mocha failure count.\n });\n\n // Mocha's default `onerror` handling strips the stack (to support really old\n // browsers). We upgrade this to get better stacks for async errors.\n //\n // TODO(nevir): Can we expand support to other browsers?\n if (navigator.userAgent.match(/chrome/i)) {\n window.onerror = null;\n window.addEventListener('error', function(event) {\n if (!event.error) return;\n if (event.error.ignore) return;\n runner.uncaught(event.error);\n });\n }\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from '../util.js';\n\n// We capture console events when running tests; so make sure we have a\n// reference to the original one.\nvar console = window.console;\n\nvar FONT = ';font: normal 13px \"Roboto\", \"Helvetica Neue\", \"Helvetica\", sans-serif;';\nvar STYLES = {\n plain: FONT,\n suite: 'color: #5c6bc0' + FONT,\n test: FONT,\n passing: 'color: #259b24' + FONT,\n pending: 'color: #e65100' + FONT,\n failing: 'color: #c41411' + FONT,\n stack: 'color: #c41411',\n results: FONT + 'font-size: 16px',\n};\n\n// I don't think we can feature detect this one...\nvar userAgent = navigator.userAgent.toLowerCase();\nvar CAN_STYLE_LOG = userAgent.match('firefox') || userAgent.match('webkit');\nvar CAN_STYLE_GROUP = userAgent.match('webkit');\n// Track the indent for faked `console.group`\nvar logIndent = '';\n\nfunction log(text, style) {\n text = text.split('\\n').map(function(l) { return logIndent + l; }).join('\\n');\n if (CAN_STYLE_LOG) {\n console.log('%c' + text, STYLES[style] || STYLES.plain);\n } else {\n console.log(text);\n }\n}\n\nfunction logGroup(text, style) {\n if (CAN_STYLE_GROUP) {\n console.group('%c' + text, STYLES[style] || STYLES.plain);\n } else if (console.group) {\n console.group(text);\n } else {\n logIndent = logIndent + ' ';\n log(text, style);\n }\n}\n\nfunction logGroupEnd() {\n if (console.groupEnd) {\n console.groupEnd();\n } else {\n logIndent = logIndent.substr(0, logIndent.length - 2);\n }\n}\n\nfunction logException(error) {\n log(error.stack || error.message || error, 'stack');\n}\n\n/**\n * A Mocha reporter that logs results out to the web `console`.\n *\n * @param {!Mocha.Runner} runner The runner that is being reported on.\n */\nexport default function Console(runner) {\n Mocha.reporters.Base.call(this, runner);\n\n runner.on('suite', function(suite) {\n if (suite.root) return;\n logGroup(suite.title, 'suite');\n }.bind(this));\n\n runner.on('suite end', function(suite) {\n if (suite.root) return;\n logGroupEnd();\n }.bind(this));\n\n runner.on('test', function(test) {\n logGroup(test.title, 'test');\n }.bind(this));\n\n runner.on('pending', function(test) {\n logGroup(test.title, 'pending');\n }.bind(this));\n\n runner.on('fail', function(test, error) {\n logException(error);\n }.bind(this));\n\n runner.on('test end', function(test) {\n logGroupEnd();\n }.bind(this));\n\n runner.on('end', this.logSummary.bind(this));\n}\n\n/** Prints out a final summary of test results. */\nConsole.prototype.logSummary = function logSummary() {\n logGroup('Test Results', 'results');\n\n if (this.stats.failures > 0) {\n log(util.pluralizedStat(this.stats.failures, 'failing'), 'failing');\n }\n if (this.stats.pending > 0) {\n log(util.pluralizedStat(this.stats.pending, 'pending'), 'pending');\n }\n log(util.pluralizedStat(this.stats.passes, 'passing'));\n\n if (!this.stats.failures) {\n log('test suite passed', 'passing');\n }\n log('Evaluated ' + this.stats.tests + ' tests in ' + this.stats.duration + 'ms.');\n logGroupEnd();\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * WCT-specific behavior on top of Mocha's default HTML reporter.\n *\n * @param {!Mocha.Runner} runner The runner that is being reported on.\n */\nexport default function HTML(runner) {\n var output = document.createElement('div');\n output.id = 'mocha';\n document.body.appendChild(output);\n\n runner.on('suite', function(test) {\n this.total = runner.total;\n }.bind(this));\n\n Mocha.reporters.HTML.call(this, runner);\n}\n\n// Woo! What a hack. This just saves us from adding a bunch of complexity around\n// style loading.\nvar style = document.createElement('style');\nstyle.textContent = 'html, body {' +\n ' position: relative;' +\n ' height: 100%;' +\n ' width: 100%;' +\n ' min-width: 900px;' +\n '}' +\n '#mocha, #subsuites {' +\n ' height: 100%;' +\n ' position: absolute;' +\n ' top: 0;' +\n '}' +\n '#mocha {' +\n ' box-sizing: border-box;' +\n ' margin: 0 !important;' +\n ' overflow-y: auto;' +\n ' padding: 60px 20px;' +\n ' right: 0;' +\n ' left: 500px;' +\n '}' +\n '#subsuites {' +\n ' -ms-flex-direction: column;' +\n ' -webkit-flex-direction: column;' +\n ' display: -ms-flexbox;' +\n ' display: -webkit-flex;' +\n ' display: flex;' +\n ' flex-direction: column;' +\n ' left: 0;' +\n ' width: 500px;' +\n '}' +\n '#subsuites .subsuite {' +\n ' border: 0;' +\n ' width: 100%;' +\n ' height: 100%;' +\n '}' +\n '#mocha .test.pass .duration {' +\n ' color: #555 !important;' +\n '}';\ndocument.head.appendChild(style);\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from '../util.js';\n\nvar STACKY_CONFIG = {\n indent: ' ',\n locationStrip: [\n /^https?:\\/\\/[^\\/]+/,\n /\\?.*$/,\n ],\n filter: function(line) {\n return line.location.match(/\\/web-component-tester\\/[^\\/]+(\\?.*)?$/);\n },\n};\n\n// https://github.com/visionmedia/mocha/blob/master/lib/runner.js#L36-46\nvar MOCHA_EVENTS = [\n 'start',\n 'end',\n 'suite',\n 'suite end',\n 'test',\n 'test end',\n 'hook',\n 'hook end',\n 'pass',\n 'fail',\n 'pending',\n 'childRunner end'\n];\n\n// Until a suite has loaded, we assume this many tests in it.\nvar ESTIMATED_TESTS_PER_SUITE = 3;\n\n/**\n * A Mocha-like reporter that combines the output of multiple Mocha suites.\n *\n * @param {number} numSuites The number of suites that will be run, in order to\n * estimate the total number of tests that will be performed.\n * @param {!Array.} reporters The set of reporters that\n * should receive the unified event stream.\n * @param {MultiReporter} parent The parent reporter, if present.\n */\nexport default function MultiReporter(numSuites, reporters, parent) {\n this.reporters = reporters.map(function(reporter) {\n return new reporter(this);\n }.bind(this));\n\n this.parent = parent;\n this.basePath = parent && parent.basePath || util.basePath(window.location);\n\n this.total = numSuites * ESTIMATED_TESTS_PER_SUITE;\n // Mocha reporters assume a stream of events, so we have to be careful to only\n // report on one runner at a time...\n this.currentRunner = null;\n // ...while we buffer events for any other active runners.\n this.pendingEvents = [];\n\n this.emit('start');\n}\n\n/**\n * @param {!Location|string} location The location this reporter represents.\n * @return {!Mocha.reporters.Base} A reporter-like \"class\" for each child suite\n * that should be passed to `mocha.run`.\n */\nMultiReporter.prototype.childReporter = function childReporter(location) {\n var name = this.suiteTitle(location);\n // The reporter is used as a constructor, so we can't depend on `this` being\n // properly bound.\n var self = this;\n function reporter(runner) {\n runner.name = name;\n self.bindChildRunner(runner);\n }\n reporter.title = name;\n return reporter;\n};\n\n/** Must be called once all runners have finished. */\nMultiReporter.prototype.done = function done() {\n this.complete = true;\n this.flushPendingEvents();\n this.emit('end');\n};\n\n/**\n * Emit a top level test that is not part of any suite managed by this reporter.\n *\n * Helpful for reporting on global errors, loading issues, etc.\n *\n * @param {string} title The title of the test.\n * @param {*} opt_error An error associated with this test. If falsy, test is\n * considered to be passing.\n * @param {string} opt_suiteTitle Title for the suite that's wrapping the test.\n * @param {?boolean} opt_estimated If this test was included in the original\n * estimate of `numSuites`.\n */\nMultiReporter.prototype.emitOutOfBandTest = function emitOutOfBandTest(title, opt_error, opt_suiteTitle, opt_estimated) {\n util.debug('MultiReporter#emitOutOfBandTest(', arguments, ')');\n var root = new Mocha.Suite();\n root.title = opt_suiteTitle || '';\n var test = new Mocha.Test(title, function() {\n });\n test.parent = root;\n test.state = opt_error ? 'failed' : 'passed';\n test.err = opt_error;\n\n if (!opt_estimated) {\n this.total = this.total + ESTIMATED_TESTS_PER_SUITE;\n }\n\n var runner = {total: 1};\n this.proxyEvent('start', runner);\n this.proxyEvent('suite', runner, root);\n this.proxyEvent('test', runner, test);\n if (opt_error) {\n this.proxyEvent('fail', runner, test, opt_error);\n } else {\n this.proxyEvent('pass', runner, test);\n }\n this.proxyEvent('test end', runner, test);\n this.proxyEvent('suite end', runner, root);\n this.proxyEvent('end', runner);\n};\n\n/**\n * @param {!Location|string} location\n * @return {string}\n */\nMultiReporter.prototype.suiteTitle = function suiteTitle(location) {\n var path = util.relativeLocation(location, this.basePath);\n path = util.cleanLocation(path);\n return path;\n};\n\n// Internal Interface\n\n/** @param {!Mocha.runners.Base} runner The runner to listen to events for. */\nMultiReporter.prototype.bindChildRunner = function bindChildRunner(runner) {\n MOCHA_EVENTS.forEach(function(eventName) {\n runner.on(eventName, this.proxyEvent.bind(this, eventName, runner));\n }.bind(this));\n};\n\n/**\n * Evaluates an event fired by `runner`, proxying it forward or buffering it.\n *\n * @param {string} eventName\n * @param {!Mocha.runners.Base} runner The runner that emitted this event.\n * @param {...*} var_args Any additional data passed as part of the event.\n */\nMultiReporter.prototype.proxyEvent = function proxyEvent(eventName, runner, var_args) {\n var extraArgs = Array.prototype.slice.call(arguments, 2);\n if (this.complete) {\n console.warn('out of order Mocha event for ' + runner.name + ':', eventName, extraArgs);\n return;\n }\n\n if (this.currentRunner && runner !== this.currentRunner) {\n this.pendingEvents.push(arguments);\n return;\n }\n util.debug('MultiReporter#proxyEvent(', arguments, ')');\n\n // This appears to be a Mocha bug: Tests failed by passing an error to their\n // done function don't set `err` properly.\n //\n // TODO(nevir): Track down.\n if (eventName === 'fail' && !extraArgs[0].err) {\n extraArgs[0].err = extraArgs[1];\n }\n\n if (eventName === 'start') {\n this.onRunnerStart(runner);\n } else if (eventName === 'end') {\n this.onRunnerEnd(runner);\n } else {\n this.cleanEvent(eventName, runner, extraArgs);\n this.emit.apply(this, [eventName].concat(extraArgs));\n }\n};\n\n/**\n * Cleans or modifies an event if needed.\n *\n * @param {string} eventName\n * @param {!Mocha.runners.Base} runner The runner that emitted this event.\n * @param {!Array.<*>} extraArgs\n */\nMultiReporter.prototype.cleanEvent = function cleanEvent(eventName, runner, extraArgs) {\n // Suite hierarchy\n if (extraArgs[0]) {\n extraArgs[0] = this.showRootSuite(extraArgs[0]);\n }\n\n // Normalize errors\n if (eventName === 'fail') {\n extraArgs[1] = Stacky.normalize(extraArgs[1], STACKY_CONFIG);\n }\n if (extraArgs[0] && extraArgs[0].err) {\n extraArgs[0].err = Stacky.normalize(extraArgs[0].err, STACKY_CONFIG);\n }\n};\n\n/**\n * We like to show the root suite's title, which requires a little bit of\n * trickery in the suite hierarchy.\n *\n * @param {!Mocha.Runnable} node\n */\nMultiReporter.prototype.showRootSuite = function showRootSuite(node) {\n var leaf = node = Object.create(node);\n while (node && node.parent) {\n var wrappedParent = Object.create(node.parent);\n node.parent = wrappedParent;\n node = wrappedParent;\n }\n node.root = false;\n\n return leaf;\n};\n\n/** @param {!Mocha.runners.Base} runner */\nMultiReporter.prototype.onRunnerStart = function onRunnerStart(runner) {\n util.debug('MultiReporter#onRunnerStart:', runner.name);\n this.total = this.total - ESTIMATED_TESTS_PER_SUITE + runner.total;\n this.currentRunner = runner;\n};\n\n/** @param {!Mocha.runners.Base} runner */\nMultiReporter.prototype.onRunnerEnd = function onRunnerEnd(runner) {\n util.debug('MultiReporter#onRunnerEnd:', runner.name);\n this.currentRunner = null;\n this.flushPendingEvents();\n};\n\n/**\n * Flushes any buffered events and runs them through `proxyEvent`. This will\n * loop until all buffered runners are complete, or we have run out of buffered\n * events.\n */\nMultiReporter.prototype.flushPendingEvents = function flushPendingEvents() {\n var events = this.pendingEvents;\n this.pendingEvents = [];\n events.forEach(function(eventArgs) {\n this.proxyEvent.apply(this, eventArgs);\n }.bind(this));\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as util from '../util.js';\n\nvar ARC_OFFSET = 0; // start at the right.\nvar ARC_WIDTH = 6;\n\n/**\n * A Mocha reporter that updates the document's title and favicon with\n * at-a-glance stats.\n *\n * @param {!Mocha.Runner} runner The runner that is being reported on.\n */\nexport default function Title(runner) {\n Mocha.reporters.Base.call(this, runner);\n\n runner.on('test end', this.report.bind(this));\n}\n\n/** Reports current stats via the page title and favicon. */\nTitle.prototype.report = function report() {\n this.updateTitle();\n this.updateFavicon();\n};\n\n/** Updates the document title with a summary of current stats. */\nTitle.prototype.updateTitle = function updateTitle() {\n if (this.stats.failures > 0) {\n document.title = util.pluralizedStat(this.stats.failures, 'failing');\n } else {\n document.title = util.pluralizedStat(this.stats.passes, 'passing');\n }\n};\n\n/**\n * Draws an arc for the favicon status, relative to the total number of tests.\n *\n * @param {!CanvasRenderingContext2D} context\n * @param {number} total\n * @param {number} start\n * @param {number} length\n * @param {string} color\n */\nfunction drawFaviconArc(context, total, start, length, color) {\n var arcStart = ARC_OFFSET + Math.PI * 2 * (start / total);\n var arcEnd = ARC_OFFSET + Math.PI * 2 * ((start + length) / total);\n\n context.beginPath();\n context.strokeStyle = color;\n context.lineWidth = ARC_WIDTH;\n context.arc(16, 16, 16 - ARC_WIDTH / 2, arcStart, arcEnd);\n context.stroke();\n}\n\n/** Updates the document's favicon w/ a summary of current stats. */\nTitle.prototype.updateFavicon = function updateFavicon() {\n var canvas = document.createElement('canvas');\n canvas.height = canvas.width = 32;\n var context = canvas.getContext('2d');\n\n var passing = this.stats.passes;\n var pending = this.stats.pending;\n var failing = this.stats.failures;\n var total = Math.max(this.runner.total, passing + pending + failing);\n drawFaviconArc(context, total, 0, passing, '#0e9c57');\n drawFaviconArc(context, total, passing, pending, '#f3b300');\n drawFaviconArc(context, total, pending + passing, failing, '#ff5621');\n\n this.setFavicon(canvas.toDataURL());\n};\n\n/** Sets the current favicon by URL. */\nTitle.prototype.setFavicon = function setFavicon(url) {\n var current = document.head.querySelector('link[rel=\"icon\"]');\n if (current) {\n document.head.removeChild(current);\n }\n\n var link = document.createElement('link');\n link.rel = 'icon';\n link.type = 'image/x-icon';\n link.href = url;\n link.setAttribute('sizes', '32x32');\n document.head.appendChild(link);\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as suites from './suites.js';\nimport ConsoleReporter from './reporters/console.js';\nimport HTMLReporter from './reporters/html.js';\nimport MultiReporter from './reporters/multi.js';\nimport TitleReporter from './reporters/title.js';\n\nexport var htmlSuites = [];\nexport var jsSuites = [];\n\n/**\n * @param {CLISocket} socket The CLI socket, if present.\n * @param {MultiReporter} parent The parent reporter, if present.\n * @return {!Array. 0 || suites.jsSuites.length > 0) {\n reporters.push(HTMLReporter);\n }\n\n return reporters;\n}\n\n/**\n * Yeah, hideous, but this allows us to be loaded before Mocha, which is handy.\n */\nexport function injectMocha(Mocha) {\n _injectPrototype(ConsoleReporter, Mocha.reporters.Base.prototype);\n _injectPrototype(HTMLReporter, Mocha.reporters.HTML.prototype);\n // Mocha doesn't expose its `EventEmitter` shim directly, so:\n _injectPrototype(MultiReporter, Object.getPrototypeOf(Mocha.Runner.prototype));\n}\n\nfunction _injectPrototype(klass, prototype) {\n var newPrototype = Object.create(prototype);\n // Only support\n Object.keys(klass.prototype).forEach(function(key) {\n newPrototype[key] = klass.prototype[key];\n });\n\n klass.prototype = newPrototype;\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as config from './config.js';\nimport * as reporters from './reporters.js';\nimport * as util from './util.js';\n\n/**\n * Loads all environment scripts ...synchronously ...after us.\n */\nexport function loadSync() {\n util.debug('Loading environment scripts:');\n var a11ySuite = 'web-component-tester/data/a11ySuite.js';\n var scripts = config.get('environmentScripts');\n var a11ySuiteWillBeLoaded = window.__generatedByWct || scripts.indexOf(a11ySuite) > -1;\n if (!a11ySuiteWillBeLoaded) {\n // wct is running as a bower dependency, load a11ySuite from data/\n scripts.push(a11ySuite);\n }\n scripts.forEach(function(path) {\n var url = util.expandUrl(path, config.get('root'));\n util.debug('Loading environment script:', url);\n // Synchronous load.\n document.write(''); // jshint ignore:line\n });\n util.debug('Environment scripts loaded');\n\n var imports = config.get('environmentImports');\n imports.forEach(function(path) {\n var url = util.expandUrl(path, config.get('root'));\n util.debug('Loading environment import:', url);\n // Synchronous load.\n document.write(''); // jshint ignore:line\n });\n util.debug('Environment imports loaded');\n}\n\n/**\n * We have some hard dependencies on things that should be loaded via\n * `environmentScripts`, so we assert that they're present here; and do any\n * post-facto setup.\n */\nexport function ensureDependenciesPresent() {\n _ensureMocha();\n _checkChai();\n}\n\nfunction _ensureMocha() {\n var Mocha = window.Mocha;\n if (!Mocha) {\n throw new Error('WCT requires Mocha. Please ensure that it is present in WCT.environmentScripts, or that you load it before loading web-component-tester/browser.js');\n }\n reporters.injectMocha(Mocha);\n // Magic loading of mocha's stylesheet\n var mochaPrefix = util.scriptPrefix('mocha.js');\n // only load mocha stylesheet for the test runner output\n // Not the end of the world, if it doesn't load.\n if (mochaPrefix && window.top === window.self) {\n util.loadStyle(mochaPrefix + 'mocha.css');\n }\n}\n\nfunction _checkChai() {\n if (!window.chai) {\n util.debug('Chai not present; not registering shorthands');\n return;\n }\n\n window.assert = window.chai.assert;\n window.expect = window.chai.expect;\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\nimport * as config from '../config.js';\n\n// We may encounter errors during initialization (for example, syntax errors in\n// a test file). Hang onto those (and more) until we are ready to report them.\nexport var globalErrors = [];\n\n/**\n * Hook the environment to pick up on global errors.\n */\nexport function listenForErrors() {\n window.addEventListener('error', function(event) {\n globalErrors.push(event.error);\n });\n\n // Also, we treat `console.error` as a test failure. Unless you prefer not.\n var origConsole = console;\n var origError = console.error;\n console.error = function wctShimmedError() {\n origError.apply(origConsole, arguments);\n if (config.get('trackConsoleError')) {\n throw 'console.error: ' + Array.prototype.join.call(arguments, ' ');\n }\n };\n}\n","\nvar interfaceExtensions = [];\n\n/**\n * Registers an extension that extends the global `Mocha` implementation\n * with new helper methods. These helper methods will be added to the `window`\n * when tests run for both BDD and TDD interfaces.\n */\nexport function extendInterfaces(helperName, helperFactory) {\n interfaceExtensions.push(function() {\n var Mocha = window.Mocha;\n // For all Mocha interfaces (probably just TDD and BDD):\n Object.keys(Mocha.interfaces).forEach(function(interfaceName) {\n // This is the original callback that defines the interface (TDD or BDD):\n var originalInterface = Mocha.interfaces[interfaceName];\n // This is the name of the \"teardown\" or \"afterEach\" property for the\n // current interface:\n var teardownProperty = interfaceName === 'tdd' ? 'teardown' : 'afterEach';\n // The original callback is monkey patched with a new one that appends to\n // the global context however we want it to:\n Mocha.interfaces[interfaceName] = function(suite) {\n // Call back to the original callback so that we get the base interface:\n originalInterface.apply(this, arguments);\n // Register a listener so that we can further extend the base interface:\n suite.on('pre-require', function(context, file, mocha) {\n // Capture a bound reference to the teardown function as a convenience:\n var teardown = context[teardownProperty].bind(context);\n // Add our new helper to the testing context. The helper is generated\n // by a factory method that receives the context, the teardown function\n // and the interface name and returns the new method to be added to\n // that context:\n context[helperName] = helperFactory(context, teardown, interfaceName);\n });\n };\n });\n });\n}\n\n/**\n * Applies any registered interface extensions. The extensions will be applied\n * as many times as this function is called, so don't call it more than once.\n */\nexport function applyExtensions() {\n interfaceExtensions.forEach(function(applyExtension) {\n applyExtension();\n });\n}\n","import { extendInterfaces } from './extend';\n\nextendInterfaces('fixture', function(context, teardown) {\n\n // Return context.fixture if it is already a thing, for backwards\n // compatibility with `test-fixture-mocha.js`:\n return context.fixture || function fixture(fixtureId, model) {\n\n // Automatically register a teardown callback that will restore the\n // test-fixture:\n teardown(function() {\n document.getElementById(fixtureId).restore();\n });\n\n // Find the test-fixture with the provided ID and create it, returning\n // the results:\n return document.getElementById(fixtureId).create(model);\n };\n});\n","import { extendInterfaces } from './extend';\n\n/**\n * stub\n *\n * The stub addon allows the tester to partially replace the implementation of\n * an element with some custom implementation. Usage example:\n *\n * beforeEach(function() {\n * stub('x-foo', {\n * attached: function() {\n * // Custom implementation of the `attached` method of element `x-foo`..\n * },\n * otherMethod: function() {\n * // More custom implementation..\n * },\n * // etc..\n * });\n * });\n */\nextendInterfaces('stub', function(context, teardown) {\n\n return function stub(tagName, implementation) {\n // Find the prototype of the element being stubbed:\n var proto = document.createElement(tagName).constructor.prototype;\n\n // For all keys in the implementation to stub with..\n var keys = Object.keys(implementation);\n keys.forEach(function(key) {\n // Stub the method on the element prototype with Sinon:\n sinon.stub(proto, key, implementation[key]);\n });\n\n // After all tests..\n teardown(function() {\n // For all of the keys in the implementation we stubbed..\n keys.forEach(function(key) {\n // Restore the stub:\n if (proto[key].isSinonProxy) {\n proto[key].restore();\n }\n });\n });\n };\n});\n","import { extendInterfaces } from './extend';\n\n// replacement map stores what should be\nvar replacements = {};\n\n/**\n * replace\n *\n * The replace addon allows the tester to replace all usages of one element with\n * another element within all Polymer elements created within the time span of\n * the test. Usage example:\n *\n * beforeEach(function() {\n * replace('x-foo').with('x-fake-foo');\n * });\n *\n * All annotations and attributes will be set on the placement element the way\n * they were set for the original element.\n */\nextendInterfaces('replace', function(context, teardown) {\n return function replace(oldTagName) {\n return {\n with: function(tagName) {\n // Standardizes our replacements map\n oldTagName = oldTagName.toLowerCase();\n tagName = tagName.toLowerCase();\n\n replacements[oldTagName] = tagName;\n\n // If the function is already a stub, restore it to original\n if (Polymer.Base.instanceTemplate.isSinonProxy) {\n return;\n }\n\n // Use Sinon to stub `Polymer.Base.instanceTemplate`:\n sinon.stub(Polymer.Base, 'instanceTemplate', function(template) {\n // dom to be replaced. _content is used for templatize calls the\n // content is used for every other occasion of template instantiation\n var dom = template._content || template.content;\n var templateNode = dom;\n var instanceNode;\n var instanceParent;\n\n // Traverses the tree. And places the new nodes (after replacing) into\n // a new template.\n while (templateNode) {\n if (templateNode.nodeType === Node.ELEMENT_NODE) {\n var originalTagName = templateNode.tagName.toLowerCase();\n var currentTagName = originalTagName;\n\n // determines the name of the element in the new template\n while (replacements.hasOwnProperty(currentTagName)) {\n currentTagName = replacements[currentTagName];\n }\n\n // if we have not changed this element, copy it over\n if (currentTagName === originalTagName) {\n instanceNode = document.importNode(templateNode);\n\n } else {\n // create the new node\n instanceNode = document.createElement(currentTagName);\n\n var numAttributes = templateNode.attributes.length;\n // For all attributes in the original node..\n for (var index=0; index} The titles of the runnable and its parents.\n */\nfunction getTitles(runnable) {\n var titles = [];\n while (runnable && !runnable.root && runnable.title) {\n titles.unshift(runnable.title);\n runnable = runnable.parent;\n }\n return titles;\n}\n\n/**\n * @param {!Mocha.Runnable} runnable\n * @return {string}\n */\nfunction getState(runnable) {\n if (runnable.state === 'passed') {\n return 'passing';\n } else if (runnable.state == 'failed') {\n return 'failing';\n } else if (runnable.pending) {\n return 'pending';\n } else {\n return 'unknown';\n }\n}\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n// Make sure that we use native timers, in case they're being stubbed out.\nvar setInterval = window.setInterval; // jshint ignore:line\nvar setTimeout = window.setTimeout; // jshint ignore:line\nvar requestAnimationFrame = window.requestAnimationFrame; // jshint ignore:line\n\n/**\n * Runs `stepFn`, catching any error and passing it to `callback` (Node-style).\n * Otherwise, calls `callback` with no arguments on success.\n *\n * @param {function()} callback\n * @param {function()} stepFn\n */\nwindow.safeStep = function safeStep(callback, stepFn) {\n var err;\n try {\n stepFn();\n } catch (error) {\n err = error;\n }\n callback(err);\n};\n\n/**\n * Runs your test at declaration time (before Mocha has begun tests). Handy for\n * when you need to test document initialization.\n *\n * Be aware that any errors thrown asynchronously cannot be tied to your test.\n * You may want to catch them and pass them to the done event, instead. See\n * `safeStep`.\n *\n * @param {string} name The name of the test.\n * @param {function(?function())} testFn The test function. If an argument is\n * accepted, the test will be treated as async, just like Mocha tests.\n */\nwindow.testImmediate = function testImmediate(name, testFn) {\n if (testFn.length > 0) {\n return testImmediateAsync(name, testFn);\n }\n\n var err;\n try {\n testFn();\n } catch (error) {\n err = error;\n }\n\n test(name, function(done) {\n done(err);\n });\n};\n\n/**\n * An async-only variant of `testImmediate`.\n *\n * @param {string} name\n * @param {function(?function())} testFn\n */\nwindow.testImmediateAsync = function testImmediateAsync(name, testFn) {\n var testComplete = false;\n var err;\n\n test(name, function(done) {\n var intervalId = setInterval(function() {\n if (!testComplete) return;\n clearInterval(intervalId);\n done(err);\n }, 10);\n });\n\n try {\n testFn(function(error) {\n if (error) err = error;\n testComplete = true;\n });\n } catch (error) {\n err = error;\n testComplete = true;\n }\n};\n\n/**\n * Triggers a flush of any pending events, observations, etc and calls you back\n * after they have been processed.\n *\n * @param {function()} callback\n */\nwindow.flush = function flush(callback) {\n // Ideally, this function would be a call to Polymer.dom.flush, but that doesn't\n // support a callback yet (https://github.com/Polymer/polymer-dev/issues/851),\n // ...and there's cross-browser flakiness to deal with.\n\n // Make sure that we're invoking the callback with no arguments so that the\n // caller can pass Mocha callbacks, etc.\n var done = function done() { callback(); };\n\n // Because endOfMicrotask is flaky for IE, we perform microtask checkpoints\n // ourselves (https://github.com/Polymer/polymer-dev/issues/114):\n var isIE = navigator.appName == 'Microsoft Internet Explorer';\n if (isIE && window.Platform && window.Platform.performMicrotaskCheckpoint) {\n var reallyDone = done;\n done = function doneIE() {\n Platform.performMicrotaskCheckpoint();\n setTimeout(reallyDone, 0);\n };\n }\n\n // Everyone else gets a regular flush.\n var scope;\n if (window.Polymer && window.Polymer.dom && window.Polymer.dom.flush) {\n scope = window.Polymer.dom;\n } else if (window.Polymer && window.Polymer.flush) {\n scope = window.Polymer;\n } else if (window.WebComponents && window.WebComponents.flush) {\n scope = window.WebComponents;\n }\n if (scope) {\n scope.flush();\n }\n\n // Ensure that we are creating a new _task_ to allow all active microtasks to\n // finish (the code you're testing may be using endOfMicrotask, too).\n setTimeout(done, 0);\n};\n\n/**\n * Advances a single animation frame.\n *\n * Calls `flush`, `requestAnimationFrame`, `flush`, and `callback` sequentially\n * @param {function()} callback\n */\nwindow.animationFrameFlush = function animationFrameFlush(callback) {\n flush(function() {\n requestAnimationFrame(function() {\n flush(callback);\n });\n });\n};\n\n/**\n * DEPRECATED: Use `flush`.\n * @param {function} callback\n */\nwindow.asyncPlatformFlush = function asyncPlatformFlush(callback) {\n console.warn('asyncPlatformFlush is deprecated in favor of the more terse flush()');\n return window.flush(callback);\n};\n\n/**\n *\n */\nwindow.waitFor = function waitFor(fn, next, intervalOrMutationEl, timeout, timeoutTime) {\n timeoutTime = timeoutTime || Date.now() + (timeout || 1000);\n intervalOrMutationEl = intervalOrMutationEl || 32;\n try {\n fn();\n } catch (e) {\n if (Date.now() > timeoutTime) {\n throw e;\n } else {\n if (isNaN(intervalOrMutationEl)) {\n intervalOrMutationEl.onMutation(intervalOrMutationEl, function() {\n waitFor(fn, next, intervalOrMutationEl, timeout, timeoutTime);\n });\n } else {\n setTimeout(function() {\n waitFor(fn, next, intervalOrMutationEl, timeout, timeoutTime);\n }, intervalOrMutationEl);\n }\n return;\n }\n }\n next();\n};\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n/**\n * This file is the entry point into `web-component-tester`'s browser client.\n */\nimport * as config from './config.js';\nimport * as environment from './environment.js';\nimport * as errors from './environment/errors.js';\nimport * as mocha from './mocha';\nimport * as reporters from './reporters';\nimport * as suites from './suites.js';\nimport * as util from './util.js';\nimport CLISocket from './clisocket.js';\nimport ChildRunner from './childrunner.js';\nimport MultiReporter from './reporters/multi.js';\n// Registers a bunch of globals:\nimport './environment/helpers.js';\n\n// You can configure WCT before it has loaded by assigning your custom\n// configuration to the global `WCT`.\nconfig.setup(window.WCT);\n\n// Maybe some day we'll expose WCT as a module to whatever module registry you\n// are using (aka the UMD approach), or as an es6 module.\nvar WCT = window.WCT = {};\n// A generic place to hang data about the current suite. This object is reported\n// back via the `sub-suite-start` and `sub-suite-end` events.\nWCT.share = {};\n// Until then, we get to rely on it to expose parent runners to their children.\nWCT._ChildRunner = ChildRunner;\nWCT._config = config._config;\n\n\n// Public Interface\n\n/**\n * Loads suites of tests, supporting both `.js` and `.html` files.\n *\n * @param {!Array.} files The files to load.\n */\nWCT.loadSuites = suites.loadSuites;\n\n\n// Load Process\n\nerrors.listenForErrors();\nmocha.stubInterfaces();\nenvironment.loadSync();\n\n// Give any scripts on the page a chance to declare tests and muck with things.\ndocument.addEventListener('DOMContentLoaded', function() {\n util.debug('DOMContentLoaded');\n\n environment.ensureDependenciesPresent();\n\n // We need the socket built prior to building its reporter.\n CLISocket.init(function(error, socket) {\n if (error) throw error;\n\n // Are we a child of another run?\n var current = ChildRunner.current();\n var parent = current && current.parentScope.WCT._reporter;\n util.debug('parentReporter:', parent);\n\n var childSuites = suites.activeChildSuites();\n var reportersToUse = reporters.determineReporters(socket, parent);\n // +1 for any local tests.\n var reporter = new MultiReporter(childSuites.length + 1, reportersToUse, parent);\n WCT._reporter = reporter; // For environment/compatibility.js\n\n // We need the reporter so that we can report errors during load.\n suites.loadJsSuites(reporter, function(error) {\n // Let our parent know that we're about to start the tests.\n if (current) current.ready(error);\n if (error) throw error;\n\n // Emit any errors we've encountered up til now\n errors.globalErrors.forEach(function onError(error) {\n reporter.emitOutOfBandTest('Test Suite Initialization', error);\n });\n\n suites.runSuites(reporter, childSuites, function(error) {\n // Make sure to let our parent know that we're done.\n if (current) current.done();\n if (error) throw error;\n });\n });\n });\n});\n"],"names":["config.get","util.paramsToQuery","util.getParams","util.mergeParams","util.parseUrl","util.debug","util.basePath","util.scriptPrefix","htmlSuites","jsSuites","util.getParam","util.cleanLocation","util.parallel","util.loadScript","util.whenFrameworksReady","console","util.pluralizedStat","util.relativeLocation","HTMLReporter","suites.jsSuites","suites.htmlSuites","ConsoleReporter","TitleReporter","util.expandUrl","util.loadStyle","reporters.injectMocha","setTimeout","config.setup","config._config","suites.loadSuites","errors.listenForErrors","mocha.stubInterfaces","environment.loadSync","suites.runSuites","errors.globalErrors","suites.loadJsSuites","reporters.determineReporters","suites.activeChildSuites","environment.ensureDependenciesPresent"],"mappings":";;;;;;;;;;;;;AAYA;;;;AAIA,AAAO,SAAS,mBAAmB,CAAC,QAAQ,EAAE;EAC5C,KAAK,CAAC,qBAAqB,CAAC,CAAC;EAC7B,IAAI,IAAI,GAAG,WAAW;IACpB,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAClC,QAAQ,EAAE,CAAC;GACZ,CAAC;;EAEF,SAAS,sBAAsB,GAAG;IAChC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC7B,IAAI,MAAM,CAAC,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE;MACnD,aAAa,CAAC,SAAS,CAAC,WAAW;QACjC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC7B,IAAI,EAAE,CAAC;OACR,CAAC,CAAC;KACJ,MAAM;MACL,IAAI,KAAK,GAAG,SAAS,KAAK,GAAG;QAC3B,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QACxD,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC5B,IAAI,EAAE,CAAC;OACR,CAAC;MACF,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;KACtD;GACF;;EAED,SAAS,YAAY,GAAG;;IAEtB,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxB,IAAI,MAAM,CA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AC;OAChE,CAAC,CAAC;;MAEHD,SAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,KAAK,EAAE;;QAEtD,IAAI,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC;OACxB,CAAC,CAAC;KACJ,CAAC,CAAC;GACJ,CAAC,CAAC;CACJ,CAAC,CAAC,;;"} \ No newline at end of file diff --git a/browser/mocha/replace.js b/browser/mocha/replace.js index 87d5d009..617f6c4a 100644 --- a/browser/mocha/replace.js +++ b/browser/mocha/replace.js @@ -76,6 +76,17 @@ extendInterfaces('replace', function(context, teardown) { } if (instanceParent) { + // Polymer's shady dom implementation goes through the insertion + // points and checks their parents. If the parent of a content + // tag has been stamped already, then Polymer.dom has to be aware + // of this content tag's parent. Additionally, + // Polymer.dom.appendChild does not seem to actually append the + // content nodes into the document fragment, so node.appendChild + // must also be called to actually insert the node. + if (instanceNode.tagName == 'CONTENT') { + Polymer.dom(instanceParent).appendChild(instanceNode); + } + instanceParent.appendChild(instanceNode); } @@ -84,26 +95,18 @@ extendInterfaces('replace', function(context, teardown) { instanceParent = instanceNode; templateNode = templateNode.firstChild; - // traverse laterally if you cannot traverse down - } else if (templateNode.nextSibling) { - templateNode = templateNode.nextSibling; - - // if the parent is the dom, we are done - } else if (templateNode.parentNode === dom) { - instanceParent = instanceNode.parentNode; - return instanceParent; - // traverse up } else { // traverse up until you can move laterally while (!templateNode.nextSibling) { - templateNode = templateNode.parentNode; - instanceParent = instanceParent.parentNode; - // stop traversing up if we are at the top - if (templateNode === dom) { + if (templateNode.parentNode === dom) { return instanceParent; + } else { + instanceParent = instanceParent.parentNode; } + + templateNode = templateNode.parentNode; } // traverse laterally diff --git a/package.json b/package.json index 9402a8ec..1c7a72c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web-component-tester", - "version": "4.3.0", + "version": "4.3.1", "description": "web-component-tester makes testing your web components a breeze!", "keywords": [ "browser", diff --git a/test/fixtures/integration/multiple-replace/projection-element-2.html b/test/fixtures/integration/multiple-replace/projection-element-2.html new file mode 100644 index 00000000..c77811b4 --- /dev/null +++ b/test/fixtures/integration/multiple-replace/projection-element-2.html @@ -0,0 +1,10 @@ + + + + diff --git a/test/fixtures/integration/multiple-replace/projection-element.html b/test/fixtures/integration/multiple-replace/projection-element.html new file mode 100644 index 00000000..db139df4 --- /dev/null +++ b/test/fixtures/integration/multiple-replace/projection-element.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/test/fixtures/integration/multiple-replace/tests.html b/test/fixtures/integration/multiple-replace/tests.html index 750911b9..67b3a2d2 100644 --- a/test/fixtures/integration/multiple-replace/tests.html +++ b/test/fixtures/integration/multiple-replace/tests.html @@ -5,6 +5,8 @@ + + @@ -19,6 +21,14 @@ + + + +