Sheriff-O-Matic: Fix karma for testing

Including polymer.html in karma.conf.js makes platform.js throw
"Possible attempt to load Polymer twice" when a polymer component is imported.

I think this is because polymer.html is loaded twice: once by karma and again on
the first time that the browser encounters a <link href="polymer.html">. I believe
this might happen because of the way karma includes files by appending some kind
of hash to them.

If polymer.html is parsed twice, then the <script src="polymer.js"> also runs twice.

This CL adds karma-loader.html which imports polymer.html (so it should avoid
importing it a second time) and adds a listener for polymer-ready, which I didn't
think was necessary but seems to resolve some flakiness in karma.

BUG=400387
R=ojan@chromium.org,esprehn@chromium.org

Review URL: https://codereview.chromium.org/459223002

git-svn-id: svn://svn.chromium.org/blink/trunk@180017 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 08db11ca
......@@ -20,17 +20,17 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
{pattern: 'bower_components/chai/chai.js', watched: true, included: true, served: true},
{pattern: 'bower_components/sugar/release/sugar-full.development.js', watched: true, included: true, served: true},
{pattern: 'bower_components/platform/platform.js', watched: true, included: true, served: true},
{pattern: 'bower_components/polymer/polymer.html', watched: true, included: true, served: true},
{pattern: 'bower_components/**/*.{js,html,css,map}', watched: true, included: false, served: true},
{pattern: 'node_modules/mocha/mocha.js', watched: true, included: true, served: true},
{pattern: 'polymer-load-warning.html', watched: true, included: false, served: true},
{pattern: 'model/*.html', watched: true, included: false, served: true},
{pattern: 'model/test/*.html', watched: true, included: true, served: true},
{pattern: 'scripts/*.js', watched: true, included: true, served: true},
{pattern: 'ui/*.html', watched: true, included: false, served: true},
'bower_components/platform/platform.js',
'test/karma_loader.html',
'bower_components/chai/chai.js',
'bower_components/sugar/release/sugar-full.development.js',
{pattern: 'bower_components/**/*.{js,html,css,map}', included: false},
'node_modules/mocha/mocha.js',
'polymer-load-warning.html',
{pattern: 'model/*.html', included: false},
'model/test/*.html',
'scripts/*.js',
{pattern: 'ui/*.html', included: false},
'ui/test/*',
],
......
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="../bower_components/polymer/polymer.html">
<script>
window.__karma__.loaded = function() {
window.addEventListener('polymer-ready', window.__karma__.start);
};
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment