mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
Merge branch 'jjs/presets-fe' into jjs/presets
This commit is contained in:
@ -15,8 +15,6 @@ import (
|
||||
)
|
||||
|
||||
func TestTemplateVersionPresets(t *testing.T) {
|
||||
// TODO (sasswart): Test case: what if a user tries to read presets or preset parameters from a different org?
|
||||
|
||||
t.Parallel()
|
||||
|
||||
givenPreset := codersdk.Preset{
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { action } from "@storybook/addon-actions";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { chromatic } from "testHelpers/chromatic";
|
||||
import {
|
||||
MockTemplate,
|
||||
@ -116,7 +118,7 @@ export const Parameters: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const Presets: Story = {
|
||||
export const PresetsButNoneSelected: Story = {
|
||||
args: {
|
||||
presets: [
|
||||
{
|
||||
@ -148,6 +150,15 @@ export const Presets: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const PresetSelected: Story = {
|
||||
args: PresetsButNoneSelected.args,
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await userEvent.click(canvas.getByLabelText("Preset"));
|
||||
await userEvent.click(canvas.getByText("Preset 1"));
|
||||
},
|
||||
};
|
||||
|
||||
export const ExternalAuth: Story = {
|
||||
args: {
|
||||
externalAuth: [
|
||||
|
@ -164,15 +164,6 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// TODO (sasswart): test case: what if immutable parameters are used in the preset?
|
||||
// TODO (sasswart): test case: what if presets are defined for a template version with no params?
|
||||
// TODO (sasswart): test case: what if a non active version is selected?
|
||||
// TODO (sasswart): test case: what if a preset is selected that has no parameters?
|
||||
// TODO (sasswart): what if we have preset params and autofill params on the same param?
|
||||
// TODO (sasswart): test case: if we move from preset to no preset, do we reset the params?
|
||||
// If so, how should it behave? Reset to initial value? reset to last set value?
|
||||
// TODO (sasswart): test case: rich parameters
|
||||
|
||||
const selectedPresetOption = presetOptions[selectedPresetIndex];
|
||||
let selectedPreset: TypesGen.Preset | undefined;
|
||||
for (const preset of presets) {
|
||||
|
Reference in New Issue
Block a user