mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
feat(dialogs): Vacay, Collections, Atlas and Journey in the new dialog look
Every popup of the four pages moves to the shared dialog frame the trip uses: head band with its icon, the scrolling body, the footer with its actions, and ConfirmDialog for the questions. - Vacay: settings, removing a year (now says so when it fails), the fusion request, inviting a person, a person's colour and sharing the calendar. - Collections: new and edited lists, adding a place, importing a file and a trip's places, sharing, labels and assigning them, copying to a trip, moving or duplicating, saving a trip's places and deleting a list. The stylesheet of the old import view goes. - Atlas: the country popup with the flag in its head, its choices as rows and the wishlist step; Dawarich's Atlas dialog and its accept dialog on the desktop. - Journey: creating a journey, its settings, linking a trip, inviting a contributor, the entry editor (discarding asks in a dialog) and the photo provider picker; the entry card's menu is the shared one. The phone keeps its own sheets: where a dialog is shared with it (Dawarich, the contributor invite, the provider picker) only the desktop frame changes.
This commit is contained in:
@@ -57,6 +57,13 @@ function memberRow(username: string): HTMLElement {
|
||||
return nameCell.parentElement as HTMLElement
|
||||
}
|
||||
|
||||
/** The confirm button of the leave question. The question is drawn over the
|
||||
* dialog, whose own Leave list button stays in the page, so it is the last one. */
|
||||
function confirmLeaveButton(): HTMLElement {
|
||||
const buttons = screen.getAllByRole('button', { name: 'Leave list' })
|
||||
return buttons[buttons.length - 1]
|
||||
}
|
||||
|
||||
describe('ShareCollectionModal', () => {
|
||||
beforeEach(() => {
|
||||
resetAllStores()
|
||||
@@ -90,7 +97,8 @@ describe('ShareCollectionModal', () => {
|
||||
|
||||
it('FE-COMP-COLSHARE-002: the title names the list and the roster is counted', () => {
|
||||
setup()
|
||||
expect(screen.getByRole('heading', { name: 'Share “Tokyo 2026”' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('heading', { name: 'Share list' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('heading', { name: 'Tokyo 2026' })).toBeInTheDocument()
|
||||
expect(screen.getByText('Members')).toBeInTheDocument()
|
||||
expect(screen.getByText('3')).toBeInTheDocument()
|
||||
})
|
||||
@@ -257,7 +265,7 @@ describe('ShareCollectionModal', () => {
|
||||
it('FE-COMP-COLSHARE-022: a confirmed leave calls the store and hands back to the page', async () => {
|
||||
const { props } = setup({ isOwner: false })
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Leave list' }))
|
||||
fireEvent.click(screen.getAllByRole('button', { name: 'Leave list' })[0])
|
||||
fireEvent.click(confirmLeaveButton())
|
||||
await waitFor(() => expect(actions.leave).toHaveBeenCalledWith(7))
|
||||
expect(addToast).toHaveBeenCalledWith('You left the list', 'success', undefined)
|
||||
expect(props.onAfterLeave).toHaveBeenCalledTimes(1)
|
||||
@@ -267,7 +275,7 @@ describe('ShareCollectionModal', () => {
|
||||
actions.leave.mockRejectedValue({ response: { data: { error: 'Owners cannot leave' } } })
|
||||
const { props } = setup({ isOwner: false })
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Leave list' }))
|
||||
fireEvent.click(screen.getAllByRole('button', { name: 'Leave list' })[0])
|
||||
fireEvent.click(confirmLeaveButton())
|
||||
await waitFor(() => expect(addToast).toHaveBeenCalledWith('Owners cannot leave', 'error', undefined))
|
||||
expect(props.onAfterLeave).not.toHaveBeenCalled()
|
||||
})
|
||||
@@ -286,9 +294,7 @@ describe('ShareCollectionModal', () => {
|
||||
|
||||
it('FE-COMP-COLSHARE-025: the modal close button calls onClose', () => {
|
||||
const { props } = setup()
|
||||
// The Modal chrome's only unnamed control is its close button.
|
||||
const header = screen.getByRole('heading', { name: 'Share “Tokyo 2026”' }).parentElement as HTMLElement
|
||||
fireEvent.click(header.querySelector('button') as HTMLButtonElement)
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Close' }))
|
||||
expect(props.onClose).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user