diff --git a/app/forms/firewall-rules-common.tsx b/app/forms/firewall-rules-common.tsx index 2d31a3504e..0f6f200598 100644 --- a/app/forms/firewall-rules-common.tsx +++ b/app/forms/firewall-rules-common.tsx @@ -211,7 +211,7 @@ const TargetAndHostFilterSubform = ({ )} subform.reset()} onSubmit={submitSubform} /> @@ -452,7 +452,7 @@ export const CommonFields = ({ control, nameTaken, error }: CommonFieldsProps) = portRangeForm.reset()} onSubmit={submitPortRange} /> diff --git a/app/forms/network-interface-edit.tsx b/app/forms/network-interface-edit.tsx index 401403f900..78c0f53065 100644 --- a/app/forms/network-interface-edit.tsx +++ b/app/forms/network-interface-edit.tsx @@ -128,7 +128,7 @@ export function EditNetworkInterfaceForm({ transitIpsForm.reset()} onSubmit={submitTransitIp} /> diff --git a/app/ui/lib/MiniTable.tsx b/app/ui/lib/MiniTable.tsx index b09383cf22..475aed8ed2 100644 --- a/app/ui/lib/MiniTable.tsx +++ b/app/ui/lib/MiniTable.tsx @@ -48,7 +48,7 @@ export const RemoveCell = ({ onClick, label }: { onClick: () => void; label: str type ClearAndAddButtonsProps = { addButtonCopy: string - disableClear: boolean + disabled: boolean onClear: () => void onSubmit: () => void } @@ -59,15 +59,15 @@ type ClearAndAddButtonsProps = { */ export const ClearAndAddButtons = ({ addButtonCopy, - disableClear, + disabled, onClear, onSubmit, }: ClearAndAddButtonsProps) => (
- -
diff --git a/test/e2e/firewall-rules.e2e.ts b/test/e2e/firewall-rules.e2e.ts index 7fd100fd34..4e51190fac 100644 --- a/test/e2e/firewall-rules.e2e.ts +++ b/test/e2e/firewall-rules.e2e.ts @@ -160,6 +160,9 @@ test('firewall rule form targets table', async ({ page }) => { const addButton = page.getByRole('button', { name: 'Add target' }) + // addButton should be disabled until a value is added + await expect(addButton).toBeDisabled() + // add targets with overlapping names and types to test delete await targetVpcNameField.fill('abc') @@ -181,7 +184,10 @@ test('firewall rule form targets table', async ({ page }) => { // add a subnet by selecting from a dropdown; make sure 'mock-subnet' is present in the dropdown, // even though VPC:'mock-subnet' has already been added await selectOption(page, 'Target type', 'VPC subnet') + // addButton should be disabled again, as type has changed but no value has been entered + await expect(addButton).toBeDisabled() await selectOption(page, subnetNameField, 'mock-subnet') + await expect(addButton).toBeEnabled() await addButton.click() await expectRowVisible(targets, { Type: 'subnet', Value: 'mock-subnet' })