Skip to content

Commit

Permalink
workaround test issue on Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
gronke committed Dec 5, 2016
1 parent b7e429c commit 1fec33b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/standard/utils.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
z<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
Expand Down Expand Up @@ -400,7 +400,7 @@
e.target.removeEventListener('load', loadListener);
e.target.removeEventListener('error', errorListener);
if (onload) {
onload.call(self, e, e.target);
onload.call(self, e, imprt);
}
};
imprt.addEventListener('load', loadListener);
Expand All @@ -410,7 +410,7 @@
e.target.removeEventListener('load', loadListener);
e.target.removeEventListener('error', errorListener);
if (onerror) {
onerror.call(self, e, e.target);
onerror.call(self, e, imprt);
}
};
imprt.addEventListener('error', errorListener);
Expand Down
7 changes: 4 additions & 3 deletions test/unit/dynamic-import.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,27 @@
test('importHref does not leak event listeners on load', function(done) {
var errorSpy = sinon.spy();
var createLoadSpy = function() {
var loadSpy = sinon.spy(function(e, target) {
var loadSpy = sinon.spy.create(function(e, target) {
target = e.target || target;
target.dispatchEvent(new Event('error'));
assert.isFalse(errorSpy.called, 'doesn\'t trigger the error event listener');
setTimeout(function() {
loadSpy.reset();
target.dispatchEvent(new Event('load'));
target.dispatchEvent(new Event('load'), target);
assert.isFalse(loadSpy.called, 'doesn\'t trigger the load event listener');
done();
});
});
return loadSpy;
}

Polymer.Base.importHref('dynamic-imports/async-import.html', createLoadSpy(), errorSpy, true);
});

test('importHref does not leak event listeners on error', function(done) {
var loadSpy = sinon.spy();
var createErrorSpy = function() {
var errorSpy = sinon.spy(function(e, target) {
target = e.target || target;
target.dispatchEvent(new Event('load'));
assert.isFalse(loadSpy.called, 'doesn\'t trigger the load event listener');
setTimeout(function() {
Expand Down

0 comments on commit 1fec33b

Please sign in to comment.