Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c06765b

Browse files
committed
Fix story
1 parent a20827c commit c06765b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

site/src/pages/WorkspacesPage/WorkspacesPageView.stories.tsx

+40
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ const createWorkspaceItemRef = (
2121
transition: WorkspaceTransition = "start",
2222
outdated = false,
2323
lastUsedAt = "0001-01-01",
24+
id?: string,
2425
): WorkspaceItemMachineRef => {
26+
const wsId = id ?? MockWorkspace.id
2527
return spawn(
2628
workspaceItemMachine.withContext({
2729
data: {
2830
...MockWorkspace,
31+
id: wsId,
2932
outdated,
3033
latest_build: {
3134
...MockWorkspace.latest_build,
@@ -83,6 +86,18 @@ const additionalWorkspaces: Record<string, WorkspaceItemMachineRef> = {
8386
),
8487
}
8588

89+
const fillerWorkspaces = Array(14)
90+
.fill(undefined)
91+
.map((_, i) =>
92+
createWorkspaceItemRef(
93+
"running",
94+
undefined,
95+
true,
96+
dayjs().toString(),
97+
`test-workspace-${i}`,
98+
),
99+
)
100+
86101
export default {
87102
title: "pages/WorkspacesPageView",
88103
component: WorkspacesPageView,
@@ -94,6 +109,18 @@ export default {
94109
],
95110
mapping: { ...workspaces, ...additionalWorkspaces },
96111
},
112+
onFilter: {
113+
action: "filter",
114+
},
115+
onGoToPage: {
116+
action: "go to page",
117+
},
118+
onNext: {
119+
action: "next",
120+
},
121+
onPrevious: {
122+
action: "previous",
123+
},
97124
},
98125
} as ComponentMeta<typeof WorkspacesPageView>
99126

@@ -107,16 +134,29 @@ AllStates.args = {
107134
...Object.values(workspaces),
108135
...Object.values(additionalWorkspaces),
109136
],
137+
count: 14,
110138
}
111139

112140
export const OwnerHasNoWorkspaces = Template.bind({})
113141
OwnerHasNoWorkspaces.args = {
114142
workspaceRefs: [],
143+
count: 0,
115144
filter: workspaceFilterQuery.me,
116145
}
117146

118147
export const NoResults = Template.bind({})
119148
NoResults.args = {
120149
workspaceRefs: [],
150+
count: 0,
121151
filter: "searchtearmwithnoresults",
122152
}
153+
154+
export const TwoPages = Template.bind({})
155+
TwoPages.args = {
156+
workspaceRefs: [
157+
...Object.values(workspaces),
158+
...Object.values(additionalWorkspaces),
159+
...fillerWorkspaces,
160+
],
161+
count: 28,
162+
}

0 commit comments

Comments
 (0)