Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upcoming: [M3-7842] - Update Assign Linode Drawer and improve query skipping #10263

Merged
merged 7 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Update Assign Linode Drawer and improve query skipping ([#10263](https://github.com/linode/manager/pull/10263))
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,15 @@ describe('PlacementGroupsAssignLinodesDrawer', () => {
error: [{ reason: 'Not found' }],
});

const { getByText } = renderWithTheme(
const { container } = renderWithTheme(
<PlacementGroupsAssignLinodesDrawer
onClose={vi.fn()}
open={true}
selectedPlacementGroup={placementGroupFactory.build()}
/>
);

expect(
getByText(
'There was a problem retrieving your placement group. Please try again'
)
).toBeInTheDocument();
expect(container).toBeEmptyDOMElement();
});

it('should render the drawer components', () => {
Expand Down Expand Up @@ -131,12 +127,7 @@ describe('PlacementGroupsAssignLinodesDrawer', () => {
})
);

const {
getByPlaceholderText,
getByRole,
getByTestId,
getByText,
} = renderWithTheme(
const { getByPlaceholderText, getByRole, getByText } = renderWithTheme(
<PlacementGroupsAssignLinodesDrawer
selectedPlacementGroup={placementGroupFactory.build({
affinity_type: 'anti_affinity',
Expand All @@ -148,33 +139,23 @@ describe('PlacementGroupsAssignLinodesDrawer', () => {
/>
);

const linodesSelect = getByPlaceholderText('Select a Linode');
const addLinodeButton = getByRole('button', { name: 'Add Linode' });
const removableLinodesList = getByTestId('pg-linode-removable-list');
const linodesSelect = getByPlaceholderText(
'Select Linode or type to search'
);
const assignLinodeButton = getByRole('button', { name: 'Assign Linode' });

expect(linodesSelect).toBeInTheDocument();
expect(addLinodeButton).toHaveAttribute('aria-disabled', 'true');
expect(removableLinodesList).toHaveTextContent(
'No Linodes have been assigned.'
);
expect(assignLinodeButton).toHaveAttribute('aria-disabled', 'true');

fireEvent.focus(linodesSelect);
fireEvent.change(linodesSelect, { target: { value: 'Linode-11' } });
const optionElement = getByText('Linode-11');
fireEvent.click(optionElement);

expect(addLinodeButton).not.toHaveAttribute('aria-disabled', 'true');

fireEvent.click(getByRole('button', { name: 'Add Linode' }));
expect(assignLinodeButton).not.toHaveAttribute('aria-disabled', 'true');

expect(addLinodeButton).toHaveAttribute('aria-disabled', 'true');
expect(removableLinodesList).toHaveTextContent('Linode-11');
fireEvent.click(getByRole('button', { name: 'Assign Linode' }));

const removeButton = getByRole('button', { name: 'remove Linode-11' });
fireEvent.click(removeButton);

expect(removableLinodesList).toHaveTextContent(
'No Linodes have been assigned.'
);
expect(assignLinodeButton).toHaveAttribute('aria-disabled', 'true');
});
});
Loading
Loading