Skip to content

Commit

Permalink
fixes #18830, dom-construct tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobroufa authored and dylans committed Oct 28, 2016
1 parent 208f321 commit 40221c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
5 changes: 1 addition & 4 deletions tests/unit/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ define([
'dojo/has!host-browser?./dom',
'dojo/has!host-browser?./dom-attr',
'dojo/has!host-browser?./dom-class',

// This causes the test to hang on Chrome/mac. Commenting out for now. See #18830.
// 'dojo/has!host-browser?./dom-construct',

'dojo/has!host-browser?./dom-construct',
'dojo/has!host-browser?./dom-form',
'dojo/has!host-browser?./dom-prop',
'dojo/has!host-browser?./dom-style',
Expand Down
26 changes: 17 additions & 9 deletions tests/unit/dom-construct.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,10 @@ define([
var nodes = {};
var child;
var fragment;
var container;

function clearTarget() {
document.body.innerHTML = "";
domConstruct.empty(container);
child = domConstruct.toDom(HTMLString);
nodes.last = domConstruct.toDom(lastHtml);
nodes.first = domConstruct.toDom(firstHtml);
Expand All @@ -614,13 +615,13 @@ define([
nodes.replace = domConstruct.toDom(replaceHtml);
nodes.only = domConstruct.toDom(onlyHtml);
nodes.pos = domConstruct.toDom(posHtml);
document.body.appendChild(nodes.last);
document.body.appendChild(nodes.first);
document.body.appendChild(nodes.before);
document.body.appendChild(nodes.after);
document.body.appendChild(nodes.replace);
document.body.appendChild(nodes.only);
document.body.appendChild(nodes.pos);
container.appendChild(nodes.last);
container.appendChild(nodes.first);
container.appendChild(nodes.before);
container.appendChild(nodes.after);
container.appendChild(nodes.replace);
container.appendChild(nodes.only);
container.appendChild(nodes.pos);
fragment = document.createDocumentFragment();
fragment.appendChild(document.createElement("div"));
fragment.appendChild(document.createElement("div"));
Expand All @@ -634,6 +635,14 @@ define([
}

return {
setup: function () {
document.body.innerHTML = "";
container = document.createElement("div");
document.body.appendChild(container);
},
teardown: function () {
document.body.removeChild(container);
},
beforeEach: clearTarget,
"last - place html string with node reference": function () {
domConstruct.place(HTMLString, nodes.last);
Expand Down Expand Up @@ -745,7 +754,6 @@ define([
assert.equal(1, nodes.only.children.length);
assert.isTrue(elementsEqual(child, nodes.only.firstChild));
},
setUp: clearTarget,
"only - place html string with fragment reference": function () {
domConstruct.place(HTMLString, fragment, "only");
assert.equal(1, fragment.childNodes.length);
Expand Down

0 comments on commit 40221c7

Please sign in to comment.