|
| 1 | +import { isValidElement } from "react"; |
1 | 2 | import { describe, expect, it } from "vite-plus/test"; |
2 | 3 | import { |
3 | 4 | ProviderDriverKind, |
@@ -116,13 +117,38 @@ describe("provider traits render guards", () => { |
116 | 117 | model: MODEL, |
117 | 118 | models, |
118 | 119 | modelOptions: selections(["agent", "fable"]), |
119 | | - prompt: "", |
120 | | - onPromptChange: () => {}, |
| 120 | + promptUltrathink: "none" as const, |
| 121 | + onPromptEdit: () => {}, |
121 | 122 | planModeEnabled: false, |
122 | 123 | }; |
123 | 124 | expect(renderProviderAgentPicker(args)).not.toBeNull(); |
124 | 125 | expect(renderProviderAgentMenuContent(args)).not.toBeNull(); |
125 | 126 | expect(renderProviderTraitsPicker(args)).toBeNull(); |
126 | 127 | expect(renderProviderTraitsMenuContent(args)).toBeNull(); |
127 | 128 | }); |
| 129 | + |
| 130 | + // A dropped selection shows every agent as Default and rebuilds the other |
| 131 | + // traits from defaults on the next pick. |
| 132 | + it("hands the current selections to both agent controls", () => { |
| 133 | + const args = { |
| 134 | + provider: PROVIDER, |
| 135 | + draftId: DraftId.make("draft-agent-selection"), |
| 136 | + model: MODEL, |
| 137 | + models: modelWith([ |
| 138 | + selectDescriptor("agent", [ |
| 139 | + { id: "default", label: "Default", isDefault: true }, |
| 140 | + { id: "fable", label: "fable" }, |
| 141 | + ]), |
| 142 | + ]), |
| 143 | + modelOptions: selections(["agent", "fable"]), |
| 144 | + promptUltrathink: "none" as const, |
| 145 | + onPromptEdit: () => {}, |
| 146 | + planModeEnabled: false, |
| 147 | + }; |
| 148 | + for (const control of [renderProviderAgentPicker(args), renderProviderAgentMenuContent(args)]) { |
| 149 | + expect(isValidElement<{ modelOptions?: unknown }>(control)).toBe(true); |
| 150 | + if (!isValidElement<{ modelOptions?: unknown }>(control)) continue; |
| 151 | + expect(control.props.modelOptions).toEqual(args.modelOptions); |
| 152 | + } |
| 153 | + }); |
128 | 154 | }); |
0 commit comments