Skip to content

Commit 2838fb1

Browse files
committed
Merge branch 'jjs/presets-fe' into jjs/presets
2 parents d37c3a1 + e47296c commit 2838fb1

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

coderd/presets_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import (
1515
)
1616

1717
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-
2018
t.Parallel()
2119

2220
givenPreset := codersdk.Preset{

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { action } from "@storybook/addon-actions";
22
import type { Meta, StoryObj } from "@storybook/react";
3+
import { within } from "@testing-library/react";
4+
import userEvent from "@testing-library/user-event";
35
import { chromatic } from "testHelpers/chromatic";
46
import {
57
MockTemplate,
@@ -116,7 +118,7 @@ export const Parameters: Story = {
116118
},
117119
};
118120

119-
export const Presets: Story = {
121+
export const PresetsButNoneSelected: Story = {
120122
args: {
121123
presets: [
122124
{
@@ -148,6 +150,15 @@ export const Presets: Story = {
148150
},
149151
};
150152

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+
151162
export const ExternalAuth: Story = {
152163
args: {
153164
externalAuth: [

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

-9
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
164164
);
165165

166166
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-
176167
const selectedPresetOption = presetOptions[selectedPresetIndex];
177168
let selectedPreset: TypesGen.Preset | undefined;
178169
for (const preset of presets) {

0 commit comments

Comments
 (0)