Commit 8d77289
authored
Refactor/workspace layout controller (#7768)
* refactor(activity): extract workspace layout into WorkspaceLayoutController
Move the Home button workspace layout responsibilities (_findBlocks,
repositionBlocks, setHomeContainers, _isFirstHomeClick toggle) out of
activity.js into js/activity/workspace-layout-controller.js, following
the same controller-extraction pattern used for GridController,
SearchController and SelectionController. activity.js now instantiates
the controller and keeps thin delegation stubs so existing callers are
unaffected.
Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
* test(workspace-layout-controller): add behavioral test coverage
Cover setup/wiring, findBlocks, the row/column _findBlocks toggle,
repositionBlocks breakpoint handling, resize delegation,
setHomeContainers, turtle reset behavior, and edge cases such as
empty, single-block and large workspaces.
Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
* fix(workspace-layout-controller): guard findBlocks against a missing helpfulWheelDiv
document.getElementById("helpfulWheelDiv") can return null; accessing
.style on it would throw. The pre-extraction code had the same gap,
so guard it now that the code is being touched.
Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
* refactor(workspace-layout-controller): bind delegation stubs and reduce test duplication
Use controller.method.bind(controller) instead of arrow-function
wrappers for the activity-level delegation stubs, and add a
setupActivity() test helper to collapse the repeated
makeActivity()+setupWorkspaceLayoutController() pairing across the
suite. Also correct a misleading comment (the DOM lookup isn't
cached, it's just done once).
Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
---------
Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>1 parent da3c268 commit 8d77289
5 files changed
Lines changed: 1088 additions & 368 deletions
File tree
- js
- __tests__
- activity
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
0 commit comments