File tree 3 files changed +12
-12
lines changed
site/src/pages/CreateWorkspacePage
3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ import (
15
15
)
16
16
17
17
func TestTemplateVersionPresets (t * testing.T ) {
18
- // TODO (sasswart): Test case: what if a user tries to read presets or preset parameters from a different org?
19
-
20
18
t .Parallel ()
21
19
22
20
givenPreset := codersdk.Preset {
Original file line number Diff line number Diff line change 1
1
import { action } from "@storybook/addon-actions" ;
2
2
import type { Meta , StoryObj } from "@storybook/react" ;
3
+ import { within } from "@testing-library/react" ;
4
+ import userEvent from "@testing-library/user-event" ;
3
5
import { chromatic } from "testHelpers/chromatic" ;
4
6
import {
5
7
MockTemplate ,
@@ -116,7 +118,7 @@ export const Parameters: Story = {
116
118
} ,
117
119
} ;
118
120
119
- export const Presets : Story = {
121
+ export const PresetsButNoneSelected : Story = {
120
122
args : {
121
123
presets : [
122
124
{
@@ -148,6 +150,15 @@ export const Presets: Story = {
148
150
} ,
149
151
} ;
150
152
153
+ export const PresetSelected : Story = {
154
+ args : PresetsButNoneSelected . args ,
155
+ play : async ( { canvasElement } ) => {
156
+ const canvas = within ( canvasElement ) ;
157
+ await userEvent . click ( canvas . getByLabelText ( "Preset" ) ) ;
158
+ await userEvent . click ( canvas . getByText ( "Preset 1" ) ) ;
159
+ } ,
160
+ } ;
161
+
151
162
export const ExternalAuth : Story = {
152
163
args : {
153
164
externalAuth : [
Original file line number Diff line number Diff line change @@ -164,15 +164,6 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
164
164
) ;
165
165
166
166
useEffect ( ( ) => {
167
- // TODO (sasswart): test case: what if immutable parameters are used in the preset?
168
- // TODO (sasswart): test case: what if presets are defined for a template version with no params?
169
- // TODO (sasswart): test case: what if a non active version is selected?
170
- // TODO (sasswart): test case: what if a preset is selected that has no parameters?
171
- // TODO (sasswart): what if we have preset params and autofill params on the same param?
172
- // TODO (sasswart): test case: if we move from preset to no preset, do we reset the params?
173
- // If so, how should it behave? Reset to initial value? reset to last set value?
174
- // TODO (sasswart): test case: rich parameters
175
-
176
167
const selectedPresetOption = presetOptions [ selectedPresetIndex ] ;
177
168
let selectedPreset : TypesGen . Preset | undefined ;
178
169
for ( const preset of presets ) {
You can’t perform that action at this time.
0 commit comments