Skip to content

Commit 7cb59be

Browse files
committed
test: sidebar resizer stays parked while collapsed
1 parent 2cddcff commit 7cb59be

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/spec/CentralControlBar-integ-test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,36 @@ define(function (require, exports, module) {
230230
SidebarView.show();
231231
await awaitsFor(function () { return SidebarView.isVisible(); }, "sidebar to show again", 2000);
232232
});
233+
234+
it("should keep the handle parked at the CCB edge when the layout is clamped while hidden",
235+
async function () {
236+
await openLivePreview();
237+
SidebarView.hide();
238+
await awaitsFor(function () { return !SidebarView.isVisible(); }, "sidebar to hide", 2000);
239+
240+
const toolbarWidth = _$("#main-toolbar").is(":visible") ? _$("#main-toolbar").width() : 0;
241+
const maxSidebar = testWindow.innerWidth - CCB_WIDTH - toolbarWidth - 100;
242+
const overLimitWidth = maxSidebar + 50;
243+
expect(overLimitWidth).toBeLessThan(testWindow.innerWidth);
244+
_$("#sidebar").width(overLimitWidth);
245+
246+
testWindow.dispatchEvent(new testWindow.Event("resize"));
247+
248+
const $resizer = _$(".main-view > .horz-resizer");
249+
expect($resizer.length).toBe(1);
250+
expect(Math.round($resizer[0].getBoundingClientRect().left)).toBe(CCB_WIDTH);
251+
expect(_$("#sidebar")[0].offsetWidth).toBe(overLimitWidth);
252+
253+
SidebarView.show();
254+
await awaitsFor(function () { return SidebarView.isVisible(); }, "sidebar to show again", 2000);
255+
const sidebarWidth = _$("#sidebar")[0].offsetWidth;
256+
expect(sidebarWidth).toBeLessThan(overLimitWidth);
257+
const $shownResizer = _$("#sidebar > .horz-resizer");
258+
expect(Math.round($shownResizer[0].getBoundingClientRect().left))
259+
.toBe(sidebarWidth + CCB_WIDTH);
260+
261+
SidebarView.resize(200);
262+
});
233263
});
234264

235265
describe("2. CCB buttons", function () {

0 commit comments

Comments
 (0)