Skip to content

Commit

Permalink
fix scroll & jumping issues with task dropdown, fixes ST-395
Browse files Browse the repository at this point in the history
  • Loading branch information
Onatcer committed Sep 6, 2024
1 parent 3a3edbf commit 776255d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
30 changes: 30 additions & 0 deletions e2e/clients.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,34 @@ test('test that creating and deleting a new client via the modal works', async (
);
});

test('test that archiving and unarchiving clients works', async ({ page }) => {
const newClientName = 'New Client ' + Math.floor(1 + Math.random() * 10000);
await goToProjectsOverview(page);
await page.getByRole('button', { name: 'Create Client' }).click();
await page.getByLabel('Client Name').fill(newClientName);

await page.getByRole('button', { name: 'Create Client' }).nth(1).click();
await expect(page.getByText(newClientName)).toBeVisible();

await page.getByRole('row').first().getByRole('button').click();
await Promise.all([
page.getByRole('button').getByText('Archive').first().click(),
expect(page.getByText(newClientName)).not.toBeVisible(),
]);
await Promise.all([
page.getByRole('tab', { name: 'Archived' }).click(),
expect(page.getByText(newClientName)).toBeVisible(),
]);

await page.getByRole('row').first().getByRole('button').click();
await Promise.all([
page.getByRole('button').getByText('Unarchive').first().click(),
expect(page.getByText(newClientName)).not.toBeVisible(),
]);
await Promise.all([
page.getByRole('tab', { name: 'Active' }).click(),
expect(page.getByText(newClientName)).toBeVisible(),
]);
});

// TODO: Add Name Update Test
6 changes: 4 additions & 2 deletions resources/js/packages/ui/src/Input/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,21 @@ const { floatingStyles } = useFloating(reference, floating, {
placement: props.align,
whileElementsMounted: autoUpdate,
middleware: [
flip(),
offset(10),
shift({
limiter: limitShift({
offset: 5,
}),
}),
flip({
fallbackAxisSideDirection: 'start',
}),
],
});
</script>

<template>
<div class="min-w-0">
<div class="min-w-0 isolate">
<div @click.prevent="toggleOpen" ref="reference" class="min-w-0">
<slot name="trigger" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ watch(open, (isOpen) => {
if (isOpen) {
nextTick(() => {
initializeHighlightedItem();
searchInput.value?.focus();
searchInput.value?.focus({ preventScroll: true });
});
}
});
Expand Down

0 comments on commit 776255d

Please sign in to comment.