forked from kevadesu/forgejo
[UI] Convert milestone to HTMX
- Currently if you want to update the milestone of an issue or pull request, your whole page will be reloaded to reflect the newly set milestone. This is quite unecessary, as only the milestone text is updated and a new timeline event is added. - This patch converts the milestone section in the issue/pull request sidebar to use HTMX, so it becomes a progressive element and avoids reloading the whole page to update the milestone. - The update of the milestone section itself is quite straightforward and nothing special is happening. To support adding new timeline events, a new element `#insert-timeline` is conviently placed after the last timeline event, which can be used with [`hx-swap-oob`](https://htmx.org/attributes/hx-swap-oob/) to position new timeline events before that element. - Adds E2E test.
This commit is contained in:
parent
48587aca23
commit
d731dc793b
8 changed files with 120 additions and 41 deletions
|
@ -84,3 +84,27 @@ test('Issue: Labels', async ({browser}, workerInfo) => {
|
|||
await expect(labelList.filter({hasText: 'label2'})).not.toBeVisible();
|
||||
await expect(labelList.filter({hasText: 'label1'})).toBeVisible();
|
||||
});
|
||||
|
||||
test('Issue: Milestone', async ({browser}, workerInfo) => {
|
||||
test.skip(workerInfo.project.name === 'Mobile Safari', 'Unable to get tests working on Safari Mobile, see https://codeberg.org/forgejo/forgejo/pulls/3445#issuecomment-1789636');
|
||||
const page = await login({browser}, workerInfo);
|
||||
|
||||
const response = await page.goto('/user2/repo1/issues/1');
|
||||
await expect(response?.status()).toBe(200);
|
||||
|
||||
const selectedMilestone = page.locator('.issue-content-right .select-milestone.list');
|
||||
const milestoneDropdown = page.locator('.issue-content-right .select-milestone.dropdown');
|
||||
await expect(selectedMilestone).toContainText('No milestone');
|
||||
|
||||
// Add milestone.
|
||||
await milestoneDropdown.click();
|
||||
await page.getByRole('option', {name: 'milestone1'}).click();
|
||||
await expect(selectedMilestone).toContainText('milestone1');
|
||||
await expect(page.locator('.timeline-item.event').last()).toContainText('user2 added this to the milestone1 milestone');
|
||||
|
||||
// Clear milestone.
|
||||
await milestoneDropdown.click();
|
||||
await page.getByText('Clear milestone', {exact: true}).click();
|
||||
await expect(selectedMilestone).toContainText('No milestone');
|
||||
await expect(page.locator('.timeline-item.event').last()).toContainText('user2 removed this from the milestone1 milestone');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue