Planned as mainview-category integration tests (spawns full Phoenix iframe so
sidebar, CCB, live-preview panel, and main-toolbar are all real). Single suite:
describe("mainview: central control bar + design mode", function () { … });Keep this file updated as we add coverage; remove lines as suites land.
-
#centralControlBarexists at boot, positioned between sidebar and.content, 30px wide. - CCB groups render in order: collapse-editor, sidebar-toggle, undo/redo, save, nav (search / back / forward), vertical filename label.
- Sidebar's
data-minsizeis30(so drag can't auto-collapse below CCB). - Sidebar's resizer handle is shifted right of the CCB via CSS
transform: translateX(30px)— clicking atsidebar.right + 30lands on the resizer element. - When the sidebar is hidden, the Resizer moves the handle to be a sibling
of
#sidebarinside.main-view; the same shift still applies.
- Undo / Redo / Save buttons fire
Commands.EDIT_UNDO,EDIT_REDO,FILE_SAVErespectively. - Search / Back / Forward / Show-in-Tree buttons still trigger the
NavigationProviderbehaviors after being moved out of#mainNavBarRight. -
#ccbSidebarToggleBtnexecutesVIEW_HIDE_SIDEBARand the icon flipsfa-angles-left↔fa-angles-righton panelCollapsed/panelExpanded. - The old
#sidebar-toggle-btnin the menubar is NOT in the DOM. -
#ccbShowInTreeBtnis rendered in.ccb-group-navdirectly below#searchNavand has atitleofStrings.CMD_SHOW_IN_TREE. - Clicking
#ccbShowInTreeBtnexecutesNAVIGATE_SHOW_IN_FILE_TREE(if sidebar was hidden, it re-opens as part of the command). - Binoculars
<svg>renders and inherits.ccb-btncolor (currentColoron the path). - Neither
#ccbFileLabel,.ccb-group-file,.ccb-file-label,.ccb-file-name, nor.ccb-file-dotexists in the DOM or in the compiled CSS.
-
Commands.VIEW_TOGGLE_DESIGN_MODE === "view.toggleDesignMode"is registered at module load, visible viaCommandManager.get. - Default keybinding:
Ctrl-F11(frombase-config/keyboard.json). - File menu has "Toggle Design Mode" directly below "Live Preview" and above "Reload Live Preview".
- Command's checked state mirrors
WorkspaceManager.isInDesignMode()on both entry and exit. - Clicking
#ccbCollapseEditorBtnroutes through the command (verify via a spy onCommandManager.execute). - Icon swap:
fa-feather(expanded) ↔fa-code(design mode). Title swap: "Switch to Visual Edit" ↔ "Switch to Code Editor".
- With live preview closed: executing the toggle first opens LP (verify a
single execution of
FILE_LIVE_FILE_PREVIEW), then applies collapsed layout on its.always(). - With live preview open: sidebar width is preserved,
.contentgoes towidth: 0,#main-toolbargetsleft: sidebarW + 30,width: innerWidth - sidebarW - 30with!important,right: auto. -
savedToolbarWidthcaptures pre-collapse#main-toolbar.outerWidthfor later restore (only when LP was already open). -
$sidebar.data("maxsize")is stored and replaced with"1000%"soResizer.updateResizeLimitsdoesn't shrink the sidebar on subsequent window resizes. -
#main-toolbar > .horz-resizergetsdisplay: nonevia CSS. -
document.bodygets classccb-editor-collapsed. -
WorkspaceManager.isInDesignMode()returnstrueandEVENT_WORKSPACE_DESIGN_MODE_CHANGEfires withtrue.
- Before flipping the body class,
sidebar.style.widthis pinned to the currently rendered (max-width-capped) value so removing the cap doesn't cause the sidebar to snap back to the stale uncapped width. -
Resizer.resyncSizerruns after the pin so the handle follows. - Normal exit restores
#main-toolbartosavedToolbarWidth(LP had been open pre-collapse) orinnerWidth / 2.5default (LP was opened by the toggle itself). Never closes LP. - Exit clamps: sidebar + CCB + toolbar + 200 (min editor) ≤ window; if
the pre-collapse toolbar width would overflow, trim the sidebar first
and
data("resyncSizer")()afterwards. -
livePanel.minWidth + iconsBarlower bound is honored when picking the restored toolbar width. -
$sidebar.data("maxsize")is restored to its saved percentage. -
WorkspaceManager.isInDesignMode()returnsfalse, event fires withfalse.
- Clicking
#toolbar-go-livewhile in design mode:- LP panel hides.
_restoreExpandedLayoutis called withskipToolbarRestore: true.#main-toolbarends at the icon-bar-only width (WSM's_hidePluginSidePanelwidth), not the pre-collapse LP size.body.ccb-editor-collapsedis removed.
- Dragging the sidebar resizer rightward grows the sidebar linearly (1:1 with mouse delta) up to the CSS max-width cap.
- CSS cap is
calc(100vw - 230px): on a 1500px viewport the rendered sidebar never exceeds ~1270px even if style.width is much larger. - During a capped drag,
style.widthmay exceed the render width (this is expected); no ResizeObserver warnings land inconsole.error. - Dragging back left respects
data-minsize: 30(no auto-collapse via drag — only via the sidebar-toggle button). - During the drag,
panelResizeStart/panelResizeUpdate/panelResizeEndare re-fired on#main-toolbarsolpedit-helper/resize-ruler-editactivates the media-query ruler.
- After 20 synthetic
window.dispatchEvent(new Event("resize"))bursts, sidebar width is unchanged ("1000%"short-circuits the Resizer shrink loop). -
#main-toolbarstays flush with the window's right edge; theapplyingCollapsedLayoutguard keeps our reassertion from recursing throughEVENT_WORKSPACE_UPDATE_LAYOUT. - With sidebar hidden,
main-toolbarwidth tracks the full available width (no ~70–300px gap from WSM clamping).
-
#main-toolbar > .horz-resizerhasdisplay: nonewhile collapsed — user never sees / grabs it; sidebar resizer is the only splitter. - Normal mode: main-toolbar resizer is visible and draggable as usual.
- Setting width W while collapsed resizes the sidebar to
window - W - pluginIcons - 30 (CCB)(clamped to ≥ 0) and derives main-toolbar width accordingly. - Setting width W in normal mode falls through to the original
implementation (which clamps against 75% window /
window - sidebar - 100).
- Enter design → drag sidebar past cap → exit → re-enter: CCB,
main-toolbar, sidebar all end up aligned (
ccb.left === sidebar.right,mainToolbar.left === sidebar.right + 30). - After the cycle,
sidebar.style.width === sidebar.offsetWidth + "px"(pinned at the capped value, not the uncapped Resizer value). - Toggle back to normal mode preserves live preview (panel stays open
at
savedToolbarWidthor the default).
Each of these invocations must exit design mode before running its
own behavior. Verify WorkspaceManager.isInDesignMode() is true
pre-action, then false post-action, and that the feature's UI
renders on the normal editor chrome (not a blank / broken region).
- Clicking
#app-drawer-buttonwhile in design mode exits design mode, then toggles the default (tools) bottom panel. - Running
Commands.CMD_FIND_IN_FILESwhile in design mode exits design mode before the find bar / results panel mount. - Running
Commands.NAVIGATE_QUICK_OPENwhile in design mode exits design mode before Quick Open's modal bar is shown. - Clicking
#git-toolbar-iconwhile in design mode exits design mode, thenPanel.toggle()opens/closes the git panel. - In the above four cases, when NOT in design mode the auto-exit branch is skipped and the original behavior runs unchanged.
Future follow-ups (no tests yet — track as TODOs alongside the site comments added in the source files):
- Tools panel floats over live preview so users can peek without leaving design mode.
- Find in Files renders an overlay modal bar and a floating results surface compatible with design mode.
- Quick Open gets a spotlight-style floating picker usable in design mode.
- Git panel gains a floating variant for design mode.
- Design mode + toggling
noDistractionspreference totrue:- sidebar hides,
- main-toolbar and bottom panels stay visible,
_hidePanelsIfRequiredis NOT invoked (spy).
- Design mode + toggling
noDistractionstofalse:- sidebar shows,
_showPanelsIfRequiredis NOT invoked.
- Normal mode + toggling
noDistractions: original behavior —ViewUtils.hideMainToolBar(), sidebar hide, panels hidden.
-
WorkspaceManager.isInDesignModeexists and returns the current state. -
WorkspaceManager.setDesignMode(true/false)triggersEVENT_WORKSPACE_DESIGN_MODE_CHANGEwith the new boolean. - Repeat calls to
setDesignModewith the same value do NOT fire the event. -
exports.isEditorCollapsed()/setEditorCollapsed()on CCB still work (back-compat surface).
- CCB background is
#222regardless of theme (sanity check with a forced light-theme and dark-theme load). - Icon color is
@project-panel-text-2; hover transitions to@project-panel-text-1+rgba(255,255,255,0.08)overlay. - File label has
cursor: pointerand hover adds underline.
- Each CCB button has a
titleattribute (collapse, sidebar toggle, undo, redo, save, search, back, forward). -
ccbCollapseEditorBtntitle changes with state. -
ccbSidebarToggleBtntitle changes with sidebar visibility.
- The suite is expected to run under the
mainviewcategory (embedded Phoenix iframe). UseSpecRunnerUtils.createWindowAndRunor the existing mainview bootstrap. - Never use
awaits(number)— every "wait for X" must beawaitsForon a boolean condition. - Clean up between tests:
_setEditorCollapsed(false)(if currently collapsed),- close live preview via
FILE_LIVE_FILE_PREVIEW, - reset sidebar width via
$("#sidebar").width("").
- Prefer
editor.*/WorkspaceManager.*APIs over reading inline styles directly; fall back tooffsetWidthonly where CSSmax-widthcan makestyle.widthmisleading.