@42-central/ui-react 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YWTOW7PZ.js → chunk-276RL7FX.js} +10 -10
- package/dist/{chunk-YWTOW7PZ.js.map → chunk-276RL7FX.js.map} +1 -1
- package/dist/{chunk-FUNTJZX7.js → chunk-2CL3FKEY.js} +3 -3
- package/dist/{chunk-FUNTJZX7.js.map → chunk-2CL3FKEY.js.map} +1 -1
- package/dist/{chunk-YPFSRZ3T.js → chunk-2NTCQIRP.js} +5 -5
- package/dist/{chunk-YPFSRZ3T.js.map → chunk-2NTCQIRP.js.map} +1 -1
- package/dist/{chunk-D3JYDAUZ.js → chunk-2TZU4LSX.js} +4 -4
- package/dist/{chunk-D3JYDAUZ.js.map → chunk-2TZU4LSX.js.map} +1 -1
- package/dist/{chunk-DJLNGWMM.js → chunk-6IRMKF5T.js} +3 -3
- package/dist/{chunk-DJLNGWMM.js.map → chunk-6IRMKF5T.js.map} +1 -1
- package/dist/{chunk-DT6LKNZF.js → chunk-7247WBTV.js} +5 -4
- package/dist/chunk-7247WBTV.js.map +1 -0
- package/dist/{chunk-F2FSHVO5.js → chunk-7B44J3CF.js} +7 -7
- package/dist/{chunk-F2FSHVO5.js.map → chunk-7B44J3CF.js.map} +1 -1
- package/dist/{chunk-6VYGK3Q3.js → chunk-7E7JNWOC.js} +16 -21
- package/dist/chunk-7E7JNWOC.js.map +1 -0
- package/dist/{chunk-7AQ4MN4M.js → chunk-7OGZT7U2.js} +14 -6
- package/dist/chunk-7OGZT7U2.js.map +1 -0
- package/dist/{chunk-UAYENYS2.js → chunk-AKXALCUN.js} +3 -3
- package/dist/{chunk-UAYENYS2.js.map → chunk-AKXALCUN.js.map} +1 -1
- package/dist/{chunk-BE2LWUHY.js → chunk-BMEJBY6H.js} +5 -3
- package/dist/chunk-BMEJBY6H.js.map +1 -0
- package/dist/{chunk-DHJB4UJD.js → chunk-DMI4KS32.js} +5 -5
- package/dist/{chunk-DHJB4UJD.js.map → chunk-DMI4KS32.js.map} +1 -1
- package/dist/{chunk-FB2G4LNH.js → chunk-DSZF2TW6.js} +7 -7
- package/dist/{chunk-FB2G4LNH.js.map → chunk-DSZF2TW6.js.map} +1 -1
- package/dist/{chunk-N66NC6QK.js → chunk-E3XLWMEB.js} +3 -3
- package/dist/{chunk-N66NC6QK.js.map → chunk-E3XLWMEB.js.map} +1 -1
- package/dist/{chunk-MXAACRWE.js → chunk-E52Z2FKU.js} +5 -5
- package/dist/{chunk-MXAACRWE.js.map → chunk-E52Z2FKU.js.map} +1 -1
- package/dist/chunk-F374BNL4.js +129 -0
- package/dist/chunk-F374BNL4.js.map +1 -0
- package/dist/{chunk-3L5GLI67.js → chunk-I4B3N3UX.js} +3 -3
- package/dist/{chunk-3L5GLI67.js.map → chunk-I4B3N3UX.js.map} +1 -1
- package/dist/{chunk-IPYHTCFL.js → chunk-IUK7OJXZ.js} +3 -3
- package/dist/{chunk-IPYHTCFL.js.map → chunk-IUK7OJXZ.js.map} +1 -1
- package/dist/{chunk-HRNWWL3Y.js → chunk-J2NW7JID.js} +61 -29
- package/dist/chunk-J2NW7JID.js.map +1 -0
- package/dist/{chunk-MRAJ45IM.js → chunk-JDPVD2YE.js} +5 -5
- package/dist/{chunk-MRAJ45IM.js.map → chunk-JDPVD2YE.js.map} +1 -1
- package/dist/{chunk-SZEOTXRZ.js → chunk-JFB6O7IY.js} +5 -5
- package/dist/{chunk-SZEOTXRZ.js.map → chunk-JFB6O7IY.js.map} +1 -1
- package/dist/{chunk-2MXWEIMD.js → chunk-KKLCHLCZ.js} +12 -11
- package/dist/chunk-KKLCHLCZ.js.map +1 -0
- package/dist/{chunk-6N6J2DOE.js → chunk-LIZWCWED.js} +3 -3
- package/dist/{chunk-6N6J2DOE.js.map → chunk-LIZWCWED.js.map} +1 -1
- package/dist/chunk-LJVIZNPE.js +9 -0
- package/dist/chunk-LJVIZNPE.js.map +1 -0
- package/dist/{chunk-HQPU73WV.js → chunk-LYGOFMXJ.js} +3 -3
- package/dist/{chunk-HQPU73WV.js.map → chunk-LYGOFMXJ.js.map} +1 -1
- package/dist/{chunk-JVG5ISPT.js → chunk-N42EFOML.js} +4 -4
- package/dist/{chunk-JVG5ISPT.js.map → chunk-N42EFOML.js.map} +1 -1
- package/dist/{chunk-C4NFRSOR.js → chunk-NF2PBGD3.js} +38 -25
- package/dist/chunk-NF2PBGD3.js.map +1 -0
- package/dist/{chunk-DA4QII2N.js → chunk-NLSJ6T7V.js} +4 -4
- package/dist/{chunk-DA4QII2N.js.map → chunk-NLSJ6T7V.js.map} +1 -1
- package/dist/{chunk-UT3TOV2Q.js → chunk-OVT2KZHY.js} +3 -3
- package/dist/{chunk-UT3TOV2Q.js.map → chunk-OVT2KZHY.js.map} +1 -1
- package/dist/{chunk-MW42XVPD.js → chunk-PBSVX5DB.js} +15 -5
- package/dist/chunk-PBSVX5DB.js.map +1 -0
- package/dist/{chunk-SVKN5ZHX.js → chunk-PEHFWGTT.js} +16 -13
- package/dist/chunk-PEHFWGTT.js.map +1 -0
- package/dist/{chunk-J44FJ7PH.js → chunk-PFZMB3US.js} +4 -4
- package/dist/{chunk-J44FJ7PH.js.map → chunk-PFZMB3US.js.map} +1 -1
- package/dist/{chunk-IRNF274I.js → chunk-PT22KEVD.js} +5 -5
- package/dist/{chunk-IRNF274I.js.map → chunk-PT22KEVD.js.map} +1 -1
- package/dist/{chunk-OZMSXYBX.js → chunk-QEAF57ZQ.js} +4 -4
- package/dist/{chunk-OZMSXYBX.js.map → chunk-QEAF57ZQ.js.map} +1 -1
- package/dist/{chunk-SWVUXEBT.js → chunk-SCXXJDKQ.js} +3 -3
- package/dist/{chunk-SWVUXEBT.js.map → chunk-SCXXJDKQ.js.map} +1 -1
- package/dist/{chunk-E5H3YWZV.js → chunk-SOUDKESO.js} +15 -8
- package/dist/chunk-SOUDKESO.js.map +1 -0
- package/dist/{chunk-4FEOMQYR.js → chunk-THGJLR5S.js} +6 -6
- package/dist/{chunk-4FEOMQYR.js.map → chunk-THGJLR5S.js.map} +1 -1
- package/dist/{chunk-TCFB23JT.js → chunk-WERJ44ZN.js} +3 -3
- package/dist/{chunk-TCFB23JT.js.map → chunk-WERJ44ZN.js.map} +1 -1
- package/dist/{chunk-QNKD2SQM.js → chunk-X3YIHN2U.js} +5 -5
- package/dist/{chunk-QNKD2SQM.js.map → chunk-X3YIHN2U.js.map} +1 -1
- package/dist/{chunk-VD6PB3VA.js → chunk-X6DESK37.js} +12 -3
- package/dist/chunk-X6DESK37.js.map +1 -0
- package/dist/{chunk-47LEAR6G.js → chunk-Y2G47ARQ.js} +6 -6
- package/dist/{chunk-47LEAR6G.js.map → chunk-Y2G47ARQ.js.map} +1 -1
- package/dist/{chunk-O7LS6OZR.js → chunk-YMVUQ2L7.js} +4 -4
- package/dist/{chunk-O7LS6OZR.js.map → chunk-YMVUQ2L7.js.map} +1 -1
- package/dist/{chunk-F342ZT7O.js → chunk-ZVECQBGG.js} +13 -7
- package/dist/chunk-ZVECQBGG.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/ambient-background/index.js +14 -26
- package/dist/components/ambient-background/index.js.map +1 -1
- package/dist/components/ambient-background/starfield.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +55 -10
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.d.ts +1 -1
- package/dist/components/app-shell/index.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +300 -39
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +5 -5
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/index.js +12 -3
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/button-group/button-group.d.ts +10 -2
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/button-multi-select/index.js +4 -4
- package/dist/components/button-select/button-select-control.d.ts +4 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +4 -1
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +4 -4
- package/dist/components/calendar/index.js +4 -4
- package/dist/components/calendar-heatmap/index.js +2 -2
- package/dist/components/camera/index.js +12 -12
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/carousel/index.js +2 -2
- package/dist/components/checkbox/checkbox.d.ts +3 -2
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/clipboard/index.js +3 -3
- package/dist/components/code-block/chrome.js +3 -3
- package/dist/components/code-block/code-block.d.ts +6 -3
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/highlighter.d.ts +16 -15
- package/dist/components/code-block/highlighter.d.ts.map +1 -1
- package/dist/components/code-block/index.d.ts +2 -1
- package/dist/components/code-block/index.d.ts.map +1 -1
- package/dist/components/code-block/index.js +85 -14
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/code-block/languages.d.ts +61 -0
- package/dist/components/code-block/languages.d.ts.map +1 -0
- package/dist/components/code-block/static.d.ts +2 -1
- package/dist/components/code-block/static.d.ts.map +1 -1
- package/dist/components/code-block/static.js +99 -10
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/combobox/index.js +5 -5
- package/dist/components/combobox-list/index.js +7 -7
- package/dist/components/compare/index.js +2 -2
- package/dist/components/data-table/index.js +32 -32
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +14 -14
- package/dist/components/download-button/index.js +2 -2
- package/dist/components/drawer/index.js +5 -5
- package/dist/components/field/field.d.ts +3 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/file-item/index.js +5 -5
- package/dist/components/file-preview/index.js +5 -5
- package/dist/components/file-trigger/index.js +2 -2
- package/dist/components/file-upload/index.js +6 -6
- package/dist/components/gallery/index.js +2 -2
- package/dist/components/geodesic/badge-frame.d.ts +13 -1
- package/dist/components/geodesic/badge-frame.d.ts.map +1 -1
- package/dist/components/geodesic/exam-badge.d.ts +4 -1
- package/dist/components/geodesic/exam-badge.d.ts.map +1 -1
- package/dist/components/geodesic/geometry.d.ts +14 -9
- package/dist/components/geodesic/geometry.d.ts.map +1 -1
- package/dist/components/geodesic/index.js +62 -23
- package/dist/components/geodesic/index.js.map +1 -1
- package/dist/components/geodesic/status.d.ts +8 -6
- package/dist/components/geodesic/status.d.ts.map +1 -1
- package/dist/components/geodesic/styles.css +15 -2
- package/dist/components/hover-card/index.js +2 -2
- package/dist/components/image-cropper/index.js +7 -7
- package/dist/components/indicator/index.js +24 -9
- package/dist/components/indicator/index.js.map +1 -1
- package/dist/components/indicator/indicator.d.ts +15 -6
- package/dist/components/indicator/indicator.d.ts.map +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +8 -8
- package/dist/components/menu/index.js +4 -4
- package/dist/components/modal/index.js +5 -5
- package/dist/components/multi-combobox-list/index.js +7 -7
- package/dist/components/multi-select/index.js +8 -8
- package/dist/components/nav-link/index.js +5 -1
- package/dist/components/nav-link/nav-link.d.ts.map +1 -1
- package/dist/components/nav-link/tanstack.js +5 -1
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/number-input/index.js +5 -5
- package/dist/components/overlays/index.js +7 -7
- package/dist/components/password-input/index.js +3 -3
- package/dist/components/photo-capture/index.js +16 -16
- package/dist/components/pills-input/index.js +5 -5
- package/dist/components/pin-input/index.js +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/index.js +1 -1
- package/dist/components/schedule/index.js +7 -7
- package/dist/components/segment-group/index.js +4 -4
- package/dist/components/segment-group/segment-group.d.ts +6 -1
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +6 -6
- package/dist/components/slider/index.js +2 -2
- package/dist/components/spotlight/index.js +11 -11
- package/dist/components/switch/index.js +14 -19
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts +1 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/tabs/index.js +3 -3
- package/dist/components/tabs/tabs-data.d.ts +4 -1
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tabs/tabs.d.ts +4 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +7 -7
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/theme-icon/index.js +1 -1
- package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
- package/dist/components/time-input/index.js +9 -9
- package/dist/components/tree-multi-select/index.js +8 -8
- package/dist/components/tree-select/index.js +5 -5
- package/dist/index.js +4 -4
- package/dist/lib/sidebar-rail.d.ts +21 -0
- package/dist/lib/sidebar-rail.d.ts.map +1 -0
- package/dist/theme.css +35 -35
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +6 -0
- package/src/components/action-icon/action-icon.tsx +3 -1
- package/src/components/ambient-background/starfield.tsx +18 -43
- package/src/components/app-shell/app-shell.test.tsx +430 -5
- package/src/components/app-shell/app-shell.tsx +484 -24
- package/src/components/app-shell/index.ts +2 -0
- package/src/components/avatar/avatar.test.tsx +12 -0
- package/src/components/avatar/avatar.tsx +9 -0
- package/src/components/badge/badge.tsx +11 -6
- package/src/components/button/button.tsx +1 -1
- package/src/components/button-group/button-group.test.tsx +24 -0
- package/src/components/button-group/button-group.tsx +21 -4
- package/src/components/button-multi-select/button-multi-select.test.tsx +15 -0
- package/src/components/button-select/button-select-control.tsx +5 -0
- package/src/components/button-select/button-select.test.tsx +25 -0
- package/src/components/button-select/button-select.tsx +13 -2
- package/src/components/card/card.tsx +10 -9
- package/src/components/checkbox/checkbox.test.tsx +17 -9
- package/src/components/checkbox/checkbox.tsx +26 -27
- package/src/components/choice-card-group/choice-card-group.tsx +3 -3
- package/src/components/code-block/code-block.tsx +7 -4
- package/src/components/code-block/highlighter.test.ts +79 -1
- package/src/components/code-block/highlighter.ts +76 -30
- package/src/components/code-block/index.ts +2 -0
- package/src/components/code-block/languages.ts +63 -0
- package/src/components/code-block/static.tsx +2 -1
- package/src/components/data-table/data-table-pagination.tsx +5 -5
- package/src/components/data-table/data-table-stack.tsx +2 -2
- package/src/components/field/field.tsx +14 -0
- package/src/components/geodesic/badge-frame.tsx +67 -13
- package/src/components/geodesic/exam-badge.tsx +8 -4
- package/src/components/geodesic/geometry.ts +8 -6
- package/src/components/geodesic/status.test.ts +11 -2
- package/src/components/geodesic/status.ts +11 -7
- package/src/components/geodesic/styles.css +15 -2
- package/src/components/indicator/indicator.test.tsx +45 -0
- package/src/components/indicator/indicator.tsx +40 -13
- package/src/components/kbd/kbd.tsx +2 -1
- package/src/components/nav-link/nav-link.test.tsx +121 -1
- package/src/components/nav-link/nav-link.tsx +78 -29
- package/src/components/segment-group/segment-group.test.tsx +22 -0
- package/src/components/segment-group/segment-group.tsx +35 -19
- package/src/components/switch/switch.test.tsx +15 -0
- package/src/components/switch/switch.tsx +27 -27
- package/src/components/table/table.test.tsx +1 -1
- package/src/components/table/table.tsx +14 -11
- package/src/components/tabs/tabs-data.tsx +5 -1
- package/src/components/tabs/tabs.test.tsx +28 -0
- package/src/components/tabs/tabs.tsx +14 -4
- package/src/components/theme-icon/theme-icon.tsx +46 -12
- package/src/lib/sidebar-rail.ts +24 -0
- package/src/theme.css +35 -35
- package/src/theme.test.ts +0 -1
- package/dist/chunk-2MXWEIMD.js.map +0 -1
- package/dist/chunk-6VYGK3Q3.js.map +0 -1
- package/dist/chunk-7AQ4MN4M.js.map +0 -1
- package/dist/chunk-7CNDZZZ6.js +0 -95
- package/dist/chunk-7CNDZZZ6.js.map +0 -1
- package/dist/chunk-BE2LWUHY.js.map +0 -1
- package/dist/chunk-C4NFRSOR.js.map +0 -1
- package/dist/chunk-DT6LKNZF.js.map +0 -1
- package/dist/chunk-E5H3YWZV.js.map +0 -1
- package/dist/chunk-F342ZT7O.js.map +0 -1
- package/dist/chunk-HRNWWL3Y.js.map +0 -1
- package/dist/chunk-MW42XVPD.js.map +0 -1
- package/dist/chunk-SVKN5ZHX.js.map +0 -1
- package/dist/chunk-VD6PB3VA.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react"
|
|
2
2
|
import { beforeEach, describe, expect, it, vi } from "vitest"
|
|
3
|
-
import { AppShell } from "./app-shell"
|
|
3
|
+
import { AppShell, useAppShell } from "./app-shell"
|
|
4
4
|
|
|
5
5
|
class MockResizeObserver {
|
|
6
6
|
static instances: MockResizeObserver[] = []
|
|
@@ -79,13 +79,16 @@ describe("AppShell (desktop — container wider than the 768 breakpoint)", () =>
|
|
|
79
79
|
expect(screen.getByText("TOC")).toBeTruthy()
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
it("Sidebar is
|
|
82
|
+
it("Sidebar is docked and expanded by default — collapsing is opt-in", () => {
|
|
83
83
|
const { container } = renderShell(1200)
|
|
84
|
-
// Aside is also an <aside>, always mounted — scope to Sidebar's own
|
|
85
|
-
const
|
|
84
|
+
// Aside is also an <aside>, always mounted — scope to Sidebar's own column.
|
|
85
|
+
const column = container.querySelector('[class*="grid-area:sidebar"]') as HTMLElement
|
|
86
|
+
const aside = column.querySelector("aside") as HTMLElement
|
|
86
87
|
expect(aside).not.toBeNull()
|
|
87
88
|
expect(aside.hasAttribute("inert")).toBe(false)
|
|
88
|
-
expect(aside.
|
|
89
|
+
expect(aside.hasAttribute("data-collapsed")).toBe(false)
|
|
90
|
+
expect(column.className).toContain(" w-72") // default size="md" (leading space excludes "xl:w-72")
|
|
91
|
+
expect(aside.className).toContain(" w-72")
|
|
89
92
|
})
|
|
90
93
|
|
|
91
94
|
it("SidebarTrigger renders nothing — there's nothing to toggle", () => {
|
|
@@ -201,6 +204,428 @@ describe("AppShell.Aside", () => {
|
|
|
201
204
|
})
|
|
202
205
|
})
|
|
203
206
|
|
|
207
|
+
function CollapsibleShell(props: {
|
|
208
|
+
collapsed?: boolean
|
|
209
|
+
defaultCollapsed?: boolean
|
|
210
|
+
onCollapsedChange?: (collapsed: boolean) => void
|
|
211
|
+
}) {
|
|
212
|
+
return (
|
|
213
|
+
<AppShell {...props}>
|
|
214
|
+
<AppShell.Sidebar aria-label="Main navigation">
|
|
215
|
+
<AppShell.SidebarHeader>
|
|
216
|
+
<AppShell.SidebarCollapseTrigger>Collapse</AppShell.SidebarCollapseTrigger>
|
|
217
|
+
</AppShell.SidebarHeader>
|
|
218
|
+
<AppShell.SidebarBody>
|
|
219
|
+
<a href="/projects">Projects</a>
|
|
220
|
+
</AppShell.SidebarBody>
|
|
221
|
+
</AppShell.Sidebar>
|
|
222
|
+
<AppShell.Header>
|
|
223
|
+
<AppShell.SidebarCollapseTrigger>Expand</AppShell.SidebarCollapseTrigger>
|
|
224
|
+
<AppShell.SidebarTrigger>Toggle</AppShell.SidebarTrigger>
|
|
225
|
+
</AppShell.Header>
|
|
226
|
+
<AppShell.Main>Content</AppShell.Main>
|
|
227
|
+
</AppShell>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function renderCollapsible(width: number, props: Parameters<typeof CollapsibleShell>[0] = {}) {
|
|
232
|
+
const result = render(<CollapsibleShell {...props} />)
|
|
233
|
+
const root = result.container.firstElementChild as HTMLElement
|
|
234
|
+
vi.spyOn(root, "getBoundingClientRect").mockReturnValue({
|
|
235
|
+
width,
|
|
236
|
+
left: 0,
|
|
237
|
+
right: width,
|
|
238
|
+
} as DOMRect)
|
|
239
|
+
act(() => {
|
|
240
|
+
for (const instance of MockResizeObserver.instances) instance.trigger()
|
|
241
|
+
})
|
|
242
|
+
const aside = screen.getByRole("complementary", { name: "Main navigation" })
|
|
243
|
+
const column = aside.parentElement as HTMLElement
|
|
244
|
+
return { ...result, root, aside, column }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
describe("AppShell collapsible sidebar (desktop)", () => {
|
|
248
|
+
it("SidebarCollapseTrigger points at the sidebar and reports its state", () => {
|
|
249
|
+
const { column } = renderCollapsible(1200)
|
|
250
|
+
const trigger = screen.getByText("Expand")
|
|
251
|
+
expect(trigger.getAttribute("aria-expanded")).toBe("true")
|
|
252
|
+
expect(trigger.getAttribute("aria-controls")).toBe(column.id)
|
|
253
|
+
expect(trigger.hasAttribute("data-collapsed")).toBe(false)
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
it("collapses: the column shrinks to zero, the aside slides out and turns inert", () => {
|
|
257
|
+
const { root, aside, column } = renderCollapsible(1200)
|
|
258
|
+
fireEvent.click(screen.getByText("Expand"))
|
|
259
|
+
|
|
260
|
+
expect(root.hasAttribute("data-sidebar-collapsed")).toBe(true)
|
|
261
|
+
expect(column.className).toContain("w-0")
|
|
262
|
+
expect(column.className).not.toContain(" w-72")
|
|
263
|
+
expect(aside.hasAttribute("data-collapsed")).toBe(true)
|
|
264
|
+
expect(aside.hasAttribute("inert")).toBe(true)
|
|
265
|
+
expect(aside.className).toContain("-translate-x-full")
|
|
266
|
+
expect(screen.getByText("Expand").getAttribute("aria-expanded")).toBe("false")
|
|
267
|
+
|
|
268
|
+
fireEvent.click(screen.getByText("Expand"))
|
|
269
|
+
expect(root.hasAttribute("data-sidebar-collapsed")).toBe(false)
|
|
270
|
+
expect(aside.hasAttribute("inert")).toBe(false)
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
it("collapsing from inside the sidebar hands focus to a trigger outside it", () => {
|
|
274
|
+
renderCollapsible(1200)
|
|
275
|
+
const inside = screen.getByText("Collapse")
|
|
276
|
+
inside.focus()
|
|
277
|
+
fireEvent.click(inside)
|
|
278
|
+
expect(document.activeElement).toBe(screen.getByText("Expand"))
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
it("hands focus to an expand trigger that only renders once collapsed", () => {
|
|
282
|
+
function ExpandWhenCollapsed() {
|
|
283
|
+
const { collapsed } = useAppShell()
|
|
284
|
+
return collapsed ? (
|
|
285
|
+
<AppShell.SidebarCollapseTrigger>Reopen</AppShell.SidebarCollapseTrigger>
|
|
286
|
+
) : null
|
|
287
|
+
}
|
|
288
|
+
render(
|
|
289
|
+
<AppShell breakpoint={0}>
|
|
290
|
+
<AppShell.Sidebar aria-label="Main navigation">
|
|
291
|
+
<AppShell.SidebarCollapseTrigger>Collapse</AppShell.SidebarCollapseTrigger>
|
|
292
|
+
</AppShell.Sidebar>
|
|
293
|
+
<AppShell.Header>
|
|
294
|
+
<ExpandWhenCollapsed />
|
|
295
|
+
</AppShell.Header>
|
|
296
|
+
</AppShell>,
|
|
297
|
+
)
|
|
298
|
+
const inside = screen.getByText("Collapse")
|
|
299
|
+
inside.focus()
|
|
300
|
+
fireEvent.click(inside)
|
|
301
|
+
expect(document.activeElement).toBe(screen.getByText("Reopen"))
|
|
302
|
+
})
|
|
303
|
+
|
|
304
|
+
it("honours a controlled `collapsed`, reporting changes through onCollapsedChange", () => {
|
|
305
|
+
const onCollapsedChange = vi.fn()
|
|
306
|
+
const { aside } = renderCollapsible(1200, { collapsed: true, onCollapsedChange })
|
|
307
|
+
expect(aside.hasAttribute("inert")).toBe(true)
|
|
308
|
+
|
|
309
|
+
fireEvent.click(screen.getByText("Expand"))
|
|
310
|
+
expect(onCollapsedChange).toHaveBeenCalledWith(false)
|
|
311
|
+
// Still controlled: nothing moves until the parent passes the new value.
|
|
312
|
+
expect(aside.hasAttribute("inert")).toBe(true)
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
it("peeks on hover over the edge strip, ignoring touch", () => {
|
|
316
|
+
const { aside, column } = renderCollapsible(1200, { defaultCollapsed: true })
|
|
317
|
+
const edge = column.querySelector("[data-sidebar-edge]") as HTMLElement
|
|
318
|
+
expect(edge).not.toBeNull()
|
|
319
|
+
|
|
320
|
+
fireEvent.pointerEnter(edge, { pointerType: "touch" })
|
|
321
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
322
|
+
|
|
323
|
+
fireEvent.pointerEnter(edge, { pointerType: "mouse" })
|
|
324
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
325
|
+
expect(aside.hasAttribute("inert")).toBe(false)
|
|
326
|
+
expect(aside.className).toContain("translate-x-2")
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
it("hides at once when the pointer leaves into the page, after a grace period near the edge", () => {
|
|
330
|
+
vi.useFakeTimers()
|
|
331
|
+
try {
|
|
332
|
+
const { aside, column } = renderCollapsible(1200, { defaultCollapsed: true })
|
|
333
|
+
const edge = column.querySelector("[data-sidebar-edge]") as HTMLElement
|
|
334
|
+
|
|
335
|
+
fireEvent.pointerEnter(edge, { pointerType: "mouse" })
|
|
336
|
+
fireEvent.pointerLeave(aside, { pointerType: "mouse", clientX: 400 })
|
|
337
|
+
act(() => vi.advanceTimersByTime(0))
|
|
338
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
339
|
+
|
|
340
|
+
fireEvent.pointerEnter(edge, { pointerType: "mouse" })
|
|
341
|
+
fireEvent.pointerLeave(aside, { pointerType: "mouse", clientX: 20 })
|
|
342
|
+
act(() => vi.advanceTimersByTime(499))
|
|
343
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
344
|
+
act(() => vi.advanceTimersByTime(1))
|
|
345
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
346
|
+
} finally {
|
|
347
|
+
vi.useRealTimers()
|
|
348
|
+
}
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
it("re-entering during the grace period keeps the card open", () => {
|
|
352
|
+
vi.useFakeTimers()
|
|
353
|
+
try {
|
|
354
|
+
const { aside, column } = renderCollapsible(1200, { defaultCollapsed: true })
|
|
355
|
+
const edge = column.querySelector("[data-sidebar-edge]") as HTMLElement
|
|
356
|
+
|
|
357
|
+
fireEvent.pointerEnter(edge, { pointerType: "mouse" })
|
|
358
|
+
fireEvent.pointerLeave(aside, { pointerType: "mouse", clientX: 20 })
|
|
359
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse" })
|
|
360
|
+
act(() => vi.advanceTimersByTime(1000))
|
|
361
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
362
|
+
} finally {
|
|
363
|
+
vi.useRealTimers()
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
it("renders no edge strip while expanded", () => {
|
|
368
|
+
const { column } = renderCollapsible(1200)
|
|
369
|
+
expect(column.querySelector("[data-sidebar-edge]")).toBeNull()
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
describe('AppShell icon-rail sidebar (collapse="icons")', () => {
|
|
374
|
+
function RailShell(props: { defaultCollapsed?: boolean }) {
|
|
375
|
+
return (
|
|
376
|
+
<AppShell {...props}>
|
|
377
|
+
<AppShell.Sidebar aria-label="Main navigation" collapse="icons">
|
|
378
|
+
<AppShell.SidebarHeader>
|
|
379
|
+
<AppShell.SidebarCollapseTrigger>Toggle rail</AppShell.SidebarCollapseTrigger>
|
|
380
|
+
</AppShell.SidebarHeader>
|
|
381
|
+
<AppShell.SidebarBody>
|
|
382
|
+
<a href="/projects">Projects</a>
|
|
383
|
+
</AppShell.SidebarBody>
|
|
384
|
+
</AppShell.Sidebar>
|
|
385
|
+
<AppShell.Main>Content</AppShell.Main>
|
|
386
|
+
</AppShell>
|
|
387
|
+
)
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function renderRail(props: { defaultCollapsed?: boolean } = {}) {
|
|
391
|
+
const result = render(<RailShell {...props} />)
|
|
392
|
+
const root = result.container.firstElementChild as HTMLElement
|
|
393
|
+
vi.spyOn(root, "getBoundingClientRect").mockReturnValue({
|
|
394
|
+
width: 1200,
|
|
395
|
+
left: 0,
|
|
396
|
+
right: 1200,
|
|
397
|
+
} as DOMRect)
|
|
398
|
+
act(() => {
|
|
399
|
+
for (const instance of MockResizeObserver.instances) instance.trigger()
|
|
400
|
+
})
|
|
401
|
+
const aside = screen.getByRole("complementary", { name: "Main navigation" })
|
|
402
|
+
return { aside, column: aside.parentElement as HTMLElement }
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
it("collapses to a 68px rail that stays on screen and interactive", () => {
|
|
406
|
+
const { aside, column } = renderRail()
|
|
407
|
+
fireEvent.click(screen.getByText("Toggle rail"))
|
|
408
|
+
|
|
409
|
+
expect(column.className).toContain("w-[calc(--spacing(17)+1px)]")
|
|
410
|
+
expect(aside.className).toContain("w-[calc(--spacing(17)+1px)]")
|
|
411
|
+
expect(aside.hasAttribute("data-sidebar-rail")).toBe(true)
|
|
412
|
+
expect(aside.hasAttribute("inert")).toBe(false)
|
|
413
|
+
expect(aside.className).not.toContain("-translate-x-full")
|
|
414
|
+
// No edge strip: the rail itself is the hover target.
|
|
415
|
+
expect(column.querySelector("[data-sidebar-edge]")).toBeNull()
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
it("hides the body's scrollbar on the rail only — a classic one would eat the rail", () => {
|
|
419
|
+
renderRail()
|
|
420
|
+
const body = screen.getByText("Projects").parentElement as HTMLElement
|
|
421
|
+
expect(body.className).toContain("sidebar-rail:[scrollbar-width:none]")
|
|
422
|
+
expect(body.className).not.toMatch(/(^| )\[scrollbar-width:none\]/)
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
it("keeps focus on its trigger, since the rail isn't hidden", () => {
|
|
426
|
+
renderRail()
|
|
427
|
+
const trigger = screen.getByText("Toggle rail")
|
|
428
|
+
trigger.focus()
|
|
429
|
+
fireEvent.click(trigger)
|
|
430
|
+
expect(document.activeElement).toBe(trigger)
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
it("peeks open only once the pointer has rested on the rail", () => {
|
|
434
|
+
vi.useFakeTimers()
|
|
435
|
+
try {
|
|
436
|
+
const { aside } = renderRail({ defaultCollapsed: true })
|
|
437
|
+
|
|
438
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse", clientX: 28, clientY: 100 })
|
|
439
|
+
act(() => vi.advanceTimersByTime(1100))
|
|
440
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
441
|
+
act(() => vi.advanceTimersByTime(100))
|
|
442
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
443
|
+
expect(aside.hasAttribute("data-sidebar-rail")).toBe(false)
|
|
444
|
+
expect(aside.className).toContain(" w-72")
|
|
445
|
+
|
|
446
|
+
fireEvent.pointerLeave(aside, { pointerType: "mouse", clientX: 600 })
|
|
447
|
+
act(() => vi.advanceTimersByTime(0))
|
|
448
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
449
|
+
expect(aside.hasAttribute("data-sidebar-rail")).toBe(true)
|
|
450
|
+
} finally {
|
|
451
|
+
vi.useRealTimers()
|
|
452
|
+
}
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
it("restarts the count whenever the pointer moves, so travelling never opens it", () => {
|
|
456
|
+
vi.useFakeTimers()
|
|
457
|
+
try {
|
|
458
|
+
const { aside } = renderRail({ defaultCollapsed: true })
|
|
459
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse", clientX: 28, clientY: 100 })
|
|
460
|
+
|
|
461
|
+
// Travel down the icons for 3s, a step every 400ms.
|
|
462
|
+
for (let y = 140; y <= 400; y += 40) {
|
|
463
|
+
act(() => vi.advanceTimersByTime(400))
|
|
464
|
+
fireEvent.pointerMove(aside, { pointerType: "mouse", clientX: 28, clientY: y })
|
|
465
|
+
}
|
|
466
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
467
|
+
|
|
468
|
+
// Then rest: it opens one full delay after the last move.
|
|
469
|
+
act(() => vi.advanceTimersByTime(1199))
|
|
470
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
471
|
+
act(() => vi.advanceTimersByTime(1))
|
|
472
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
473
|
+
} finally {
|
|
474
|
+
vi.useRealTimers()
|
|
475
|
+
}
|
|
476
|
+
})
|
|
477
|
+
|
|
478
|
+
it("tolerates a few pixels of jitter while resting", () => {
|
|
479
|
+
vi.useFakeTimers()
|
|
480
|
+
try {
|
|
481
|
+
const { aside } = renderRail({ defaultCollapsed: true })
|
|
482
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse", clientX: 28, clientY: 100 })
|
|
483
|
+
act(() => vi.advanceTimersByTime(600))
|
|
484
|
+
fireEvent.pointerMove(aside, { pointerType: "mouse", clientX: 30, clientY: 102 })
|
|
485
|
+
act(() => vi.advanceTimersByTime(600))
|
|
486
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
487
|
+
} finally {
|
|
488
|
+
vi.useRealTimers()
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
it("keeps the row under the pointer as rows above it unfold, and scrolls back on close", () => {
|
|
493
|
+
vi.useFakeTimers()
|
|
494
|
+
try {
|
|
495
|
+
const { aside } = renderRail({ defaultCollapsed: true })
|
|
496
|
+
const row = screen.getByText("Projects")
|
|
497
|
+
const body = row.parentElement as HTMLElement
|
|
498
|
+
// jsdom has no layout: stand in for the scroller and the row's geometry.
|
|
499
|
+
body.style.overflowY = "auto"
|
|
500
|
+
let scrollTop = 0
|
|
501
|
+
Object.defineProperty(body, "scrollTop", {
|
|
502
|
+
get: () => scrollTop,
|
|
503
|
+
set: (value: number) => {
|
|
504
|
+
scrollTop = value
|
|
505
|
+
},
|
|
506
|
+
})
|
|
507
|
+
// The row sits at 400, minus however far the body is scrolled, plus
|
|
508
|
+
// whatever has unfolded above it.
|
|
509
|
+
let unfolded = 0
|
|
510
|
+
vi.spyOn(row, "getBoundingClientRect").mockImplementation(
|
|
511
|
+
() => ({ top: 400 + unfolded - scrollTop }) as DOMRect,
|
|
512
|
+
)
|
|
513
|
+
const elementFromPoint = vi.fn(() => row)
|
|
514
|
+
Object.defineProperty(document, "elementFromPoint", {
|
|
515
|
+
value: elementFromPoint,
|
|
516
|
+
configurable: true,
|
|
517
|
+
})
|
|
518
|
+
const before = MockResizeObserver.instances.length
|
|
519
|
+
|
|
520
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse", clientX: 28, clientY: 410 })
|
|
521
|
+
act(() => vi.advanceTimersByTime(1200))
|
|
522
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
523
|
+
expect(elementFromPoint).toHaveBeenCalledWith(28, 410)
|
|
524
|
+
|
|
525
|
+
// Two frames of rows unfolding above it: the body follows each time.
|
|
526
|
+
const anchoring = MockResizeObserver.instances.slice(before)
|
|
527
|
+
for (const grown of [35, 114]) {
|
|
528
|
+
unfolded = grown
|
|
529
|
+
for (const observer of anchoring) observer.trigger()
|
|
530
|
+
expect(row.getBoundingClientRect().top).toBe(400)
|
|
531
|
+
}
|
|
532
|
+
expect(scrollTop).toBe(114)
|
|
533
|
+
|
|
534
|
+
// Closing folds them back above the same row, walking the scroll back.
|
|
535
|
+
fireEvent.pointerLeave(aside, { pointerType: "mouse", clientX: 600 })
|
|
536
|
+
act(() => vi.advanceTimersByTime(0))
|
|
537
|
+
const closing = MockResizeObserver.instances.slice(before + anchoring.length)
|
|
538
|
+
unfolded = 0
|
|
539
|
+
for (const observer of closing) observer.trigger()
|
|
540
|
+
expect(scrollTop).toBe(0)
|
|
541
|
+
} finally {
|
|
542
|
+
vi.useRealTimers()
|
|
543
|
+
Reflect.deleteProperty(document, "elementFromPoint")
|
|
544
|
+
}
|
|
545
|
+
})
|
|
546
|
+
|
|
547
|
+
it("holds wheel scrolling through the transition and any momentum stream, then lets go", async () => {
|
|
548
|
+
vi.useFakeTimers()
|
|
549
|
+
try {
|
|
550
|
+
const { aside } = renderRail({ defaultCollapsed: true })
|
|
551
|
+
const row = screen.getByText("Projects")
|
|
552
|
+
const body = row.parentElement as HTMLElement
|
|
553
|
+
body.style.overflowY = "auto"
|
|
554
|
+
Object.defineProperty(document, "elementFromPoint", { value: () => row, configurable: true })
|
|
555
|
+
// The transition's animations, finishing when we say so.
|
|
556
|
+
let finish = () => {}
|
|
557
|
+
const finished = new Promise<void>((resolve) => {
|
|
558
|
+
finish = resolve
|
|
559
|
+
})
|
|
560
|
+
// Only once the rail opens: an enter during an animation is ignored.
|
|
561
|
+
let transitioning = false
|
|
562
|
+
Object.defineProperty(aside, "getAnimations", {
|
|
563
|
+
value: () => (transitioning ? [{ finished }] : []),
|
|
564
|
+
configurable: true,
|
|
565
|
+
})
|
|
566
|
+
const wheel = (timeStamp: number) => {
|
|
567
|
+
const event = new WheelEvent("wheel", { deltaY: -8, cancelable: true, bubbles: true })
|
|
568
|
+
Object.defineProperty(event, "timeStamp", { value: timeStamp })
|
|
569
|
+
body.dispatchEvent(event)
|
|
570
|
+
return event.defaultPrevented
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse", clientX: 28, clientY: 410 })
|
|
574
|
+
transitioning = true
|
|
575
|
+
act(() => vi.advanceTimersByTime(1200))
|
|
576
|
+
expect(aside.hasAttribute("data-peeking")).toBe(true)
|
|
577
|
+
|
|
578
|
+
// During the transition: held.
|
|
579
|
+
expect(wheel(1000)).toBe(true)
|
|
580
|
+
expect(wheel(1040)).toBe(true)
|
|
581
|
+
// Transition done, but the same stream (momentum) keeps going: still held.
|
|
582
|
+
await act(async () => finish())
|
|
583
|
+
// The anchoring lets go one frame after the animations finish.
|
|
584
|
+
act(() => vi.advanceTimersByTime(16))
|
|
585
|
+
expect(wheel(1080)).toBe(true)
|
|
586
|
+
expect(wheel(1120)).toBe(true)
|
|
587
|
+
// A pause, then a fresh scroll: the user's, so it goes through.
|
|
588
|
+
expect(wheel(1500)).toBe(false)
|
|
589
|
+
expect(wheel(1540)).toBe(false)
|
|
590
|
+
} finally {
|
|
591
|
+
vi.useRealTimers()
|
|
592
|
+
Reflect.deleteProperty(document, "elementFromPoint")
|
|
593
|
+
}
|
|
594
|
+
})
|
|
595
|
+
|
|
596
|
+
it("leaving before the dwell elapses cancels the peek", () => {
|
|
597
|
+
vi.useFakeTimers()
|
|
598
|
+
try {
|
|
599
|
+
const { aside } = renderRail({ defaultCollapsed: true })
|
|
600
|
+
fireEvent.pointerEnter(aside, { pointerType: "mouse" })
|
|
601
|
+
act(() => vi.advanceTimersByTime(300))
|
|
602
|
+
fireEvent.pointerLeave(aside, { pointerType: "mouse", clientX: 600 })
|
|
603
|
+
act(() => vi.advanceTimersByTime(2000))
|
|
604
|
+
expect(aside.hasAttribute("data-peeking")).toBe(false)
|
|
605
|
+
} finally {
|
|
606
|
+
vi.useRealTimers()
|
|
607
|
+
}
|
|
608
|
+
})
|
|
609
|
+
})
|
|
610
|
+
|
|
611
|
+
describe("AppShell collapsible sidebar (mobile)", () => {
|
|
612
|
+
it("SidebarCollapseTrigger renders nothing, and `collapsed` leaves the drawer alone", async () => {
|
|
613
|
+
render(<CollapsibleShell collapsed />)
|
|
614
|
+
const root = document.body.querySelector("div > div") as HTMLElement
|
|
615
|
+
vi.spyOn(root, "getBoundingClientRect").mockReturnValue({ width: 500 } as DOMRect)
|
|
616
|
+
act(() => {
|
|
617
|
+
for (const instance of MockResizeObserver.instances) instance.trigger()
|
|
618
|
+
})
|
|
619
|
+
|
|
620
|
+
expect(screen.queryByText("Expand")).toBeNull()
|
|
621
|
+
expect(root.hasAttribute("data-sidebar-collapsed")).toBe(false)
|
|
622
|
+
|
|
623
|
+
fireEvent.click(screen.getByText("Toggle"))
|
|
624
|
+
const drawer = await screen.findByRole("dialog", { name: "Main navigation" })
|
|
625
|
+
expect(within(drawer).getByText("Projects")).toBeTruthy()
|
|
626
|
+
})
|
|
627
|
+
})
|
|
628
|
+
|
|
204
629
|
describe("AppShell parts", () => {
|
|
205
630
|
it("throw when rendered outside <AppShell>", () => {
|
|
206
631
|
const spy = vi.spyOn(console, "error").mockImplementation(() => {})
|