Skip to content

Commit

Permalink
Fix SidePane initialization.
Browse files Browse the repository at this point in the history
The element is not necessarily attached to the DOM when refreshRendering() runs.
This bug caused test failures in tests/unit/SidePane.js.
Refs ibm-js/delite#385.
  • Loading branch information
wkeese committed Mar 20, 2015
1 parent bfce99b commit c042dfb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion SidePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ define([
_originX: NaN,
_originY: NaN,

attachedCallback: function () {
this.parentNode.style.overflow = "hidden";
},

show: dcl.superCall(function (sup) {
return function () {
if (arguments.length > 0) {
Expand Down Expand Up @@ -275,7 +279,6 @@ define([
},

refreshRendering: function (props) {
this.parentNode.style.overflow = "hidden";
if (!("mode" in props || "position" in props || "animate" in props)) {
return;
}
Expand Down
9 changes: 4 additions & 5 deletions tests/unit/SidePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ define([
origBodyStyle = document.body.style.cssText;
node = new SidePane();
document.body.appendChild(node);
register.parse();
node.show();
},
"Default values" : function () {
assert.deepEqual(node.mode, "push");
assert.deepEqual(node.position, "start");
assert.deepEqual(node.animate, true);
assert.deepEqual(node.swipeClosing, true);
assert.strictEqual(node.mode, "push");
assert.strictEqual(node.position, "start");
assert.isTrue(node.animate, "node.animate");
assert.isTrue(node.swipeClosing, "node.swipeClosing");
},
"Size Computation" : function () {
var box = domGeom.getMarginBox(node);
Expand Down

0 comments on commit c042dfb

Please sign in to comment.