1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { userEvent , within } from "@storybook/test" ;
2
3
import {
3
4
MockNoPermissions ,
4
5
MockOrganization ,
@@ -14,7 +15,7 @@ const meta: Meta<typeof OrganizationSidebarView> = {
14
15
decorators : [ withDashboardProvider ] ,
15
16
parameters : { showOrganizations : true } ,
16
17
args : {
17
- activeOrganizationName : undefined ,
18
+ activeOrganization : undefined ,
18
19
organizations : [
19
20
{
20
21
...MockOrganization ,
@@ -50,29 +51,50 @@ export const LoadingOrganizations: Story = {
50
51
51
52
export const NoCreateOrg : Story = {
52
53
args : {
54
+ activeOrganization : MockOrganization ,
53
55
permissions : {
54
56
...MockPermissions ,
55
57
createOrganization : false ,
56
58
} ,
57
59
} ,
60
+ play : async ( { canvasElement } ) => {
61
+ const canvas = within ( canvasElement ) ;
62
+ await userEvent . click (
63
+ canvas . getByRole ( "button" , { name : "My Organization" } ) ,
64
+ ) ;
65
+ } ,
58
66
} ;
59
67
60
68
export const NoPermissions : Story = {
61
69
args : {
70
+ activeOrganization : MockOrganization ,
62
71
permissions : MockNoPermissions ,
63
72
} ,
64
73
} ;
65
74
66
- export const SelectedOrgNoMatch : Story = {
75
+ export const AllPermissions : Story = {
67
76
args : {
68
- activeOrganizationName : MockOrganization . name ,
69
- organizations : [ ] ,
77
+ activeOrganization : MockOrganization ,
78
+ organizations : [
79
+ {
80
+ ...MockOrganization ,
81
+ permissions : {
82
+ editOrganization : true ,
83
+ editMembers : true ,
84
+ editGroups : true ,
85
+ auditOrganization : true ,
86
+ assignOrgRole : true ,
87
+ viewProvisioners : true ,
88
+ viewIdpSyncSettings : true ,
89
+ } ,
90
+ } ,
91
+ ] ,
70
92
} ,
71
93
} ;
72
94
73
95
export const SelectedOrgAdmin : Story = {
74
96
args : {
75
- activeOrganizationName : MockOrganization . name ,
97
+ activeOrganization : MockOrganization ,
76
98
organizations : [
77
99
{
78
100
...MockOrganization ,
@@ -90,7 +112,7 @@ export const SelectedOrgAdmin: Story = {
90
112
91
113
export const SelectedOrgAuditor : Story = {
92
114
args : {
93
- activeOrganizationName : MockOrganization . name ,
115
+ activeOrganization : MockOrganization ,
94
116
permissions : {
95
117
...MockPermissions ,
96
118
createOrganization : false ,
@@ -111,7 +133,7 @@ export const SelectedOrgAuditor: Story = {
111
133
112
134
export const SelectedOrgUserAdmin : Story = {
113
135
args : {
114
- activeOrganizationName : MockOrganization . name ,
136
+ activeOrganization : MockOrganization ,
115
137
permissions : {
116
138
...MockPermissions ,
117
139
createOrganization : false ,
@@ -132,6 +154,7 @@ export const SelectedOrgUserAdmin: Story = {
132
154
133
155
export const MultiOrgAdminAndUserAdmin : Story = {
134
156
args : {
157
+ activeOrganization : MockOrganization ,
135
158
organizations : [
136
159
{
137
160
...MockOrganization ,
@@ -157,7 +180,7 @@ export const MultiOrgAdminAndUserAdmin: Story = {
157
180
158
181
export const SelectedMultiOrgAdminAndUserAdmin : Story = {
159
182
args : {
160
- activeOrganizationName : MockOrganization2 . name ,
183
+ activeOrganization : MockOrganization2 ,
161
184
organizations : [
162
185
{
163
186
...MockOrganization ,
0 commit comments