Skip to content

Commit 9aa3341

Browse files
test(mosaic): assert aria-disabled on Add API Key button (#10249)
1 parent 9159465 commit 9aa3341

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎packages/mosaic/src/features/api-keys/__tests__/api-keys-table.feature.test.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ describe('APIKeysTable', () => {
402402

403403
await waitFor(() => expect(name).toHaveFocus());
404404
await user.type(name, 'Deploy');
405-
expect(add).toBeDisabled();
405+
expect(add).toHaveAttribute('aria-disabled', 'true');
406406

407407
await user.click(within(dialog).getByRole('combobox', { name: /^Expiration/ }));
408408
expect(screen.getAllByRole('option').map(option => option.textContent)).toEqual([
@@ -417,7 +417,7 @@ describe('APIKeysTable', () => {
417417
]);
418418
await user.click(screen.getByRole('option', { name: 'Never' }));
419419
await waitFor(() => expect(within(dialog).getByText('This key will never expire')).toBeVisible());
420-
expect(add).toBeEnabled();
420+
expect(add).not.toHaveAttribute('aria-disabled');
421421
});
422422

423423
it('requires a name longer than two characters', async () => {
@@ -426,10 +426,10 @@ describe('APIKeysTable', () => {
426426
const add = within(dialog).getByRole('button', { name: 'Add API Key' });
427427

428428
await fillCreate(user, dialog, 'ab', 'Never');
429-
expect(add).toBeDisabled();
429+
expect(add).toHaveAttribute('aria-disabled', 'true');
430430

431431
await user.type(within(dialog).getByRole('textbox', { name: 'Secret key name' }), 'c');
432-
expect(add).toBeEnabled();
432+
expect(add).not.toHaveAttribute('aria-disabled');
433433
});
434434

435435
it('holds the form while the key is created', async () => {

0 commit comments

Comments
 (0)