Unified · Split
| @@ -242,4 +242,24 @@ describe("PluginsSettingsPanel", () => { · 241 unmodified lines | ||
| 242 | 242 | visitElements(panel, (element) => element.props["data-plugin-read-only"] === true), |
| 243 | 243 | ).not.toBeNull(); |
| 244 | 244 | }); |
| 245 | + | |
| 246 | + it("disables every package action while one lifecycle mutation is pending", () => { | |
| 247 | + commands.disable.mockReturnValue(new Promise(() => undefined)); | |
| 248 | + const panel = renderPanel(); | |
| 249 | + const activeRow = renderPackageRow(panel, "com.acme.active"); | |
| 250 | + const disable = visitElements( | |
| 251 | + activeRow, | |
| 252 | + (element) => element.props["aria-label"] === "Disable com.acme.active", | |
| 253 | + ); | |
| 254 | + (disable?.props.onCheckedChange as ((checked: boolean) => void) | undefined)?.(false); | |
| 255 | + | |
| 256 | + const pendingPanel = renderPanel(); | |
| 257 | + const disabledRow = renderPackageRow(pendingPanel, "com.acme.disabled"); | |
| 258 | + const enable = visitElements( | |
| 259 | + disabledRow, | |
| 260 | + (element) => element.props["aria-label"] === "Enable com.acme.disabled", | |
| 261 | + ); | |
| 262 | + | |
| 263 | + expect(enable?.props.disabled).toBe(true); | |
| 264 | + }); | |
| 245 | 265 | }); |
| @@ -271,7 +271,7 @@ export function PluginsSettingsPanel() { · 270 unmodified lines | ||
| 271 | 271 | <PluginPackageRow |
| 272 | 272 | key={pluginPackage.id} |
| 273 | 273 | pluginPackage={pluginPackage} |
| 274 | − readOnly={readOnly} | |
| 274 | + readOnly={readOnly || pending !== null} | |
| 275 | 275 | pendingAction={ |
| 276 | 276 | pending !== null && pending.id === pluginPackage.id ? pending.action : null |
| 277 | 277 | } |