mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
feat(places): tags on places, owned by the trip
A place keeps its one category, which decides its marker, and can now carry any number of tags as extra labels to filter by. - Tags belong to the trip (tags.trip_id): every member sees the same list and whoever may edit the trip's places adds, renames and deletes. Personal tags stay what they were. - The place form picks them on desktop and mobile through one shared hook, usePlaceTags, and can add a new tag to the trip on the spot. - The existing category filter of the places list lists the tags as well. - Tags show on the place (inspector pills, phone place sheet); the marker is untouched. - MCP: create_place, create_and_assign_place and update_place take `tags`, and list/create/update/delete_trip_tag manage a trip's tags. - /api/trips/:tripId/tags and the tripTags:changed event keep every client of the trip in step.
This commit is contained in:
@@ -182,4 +182,20 @@ describe('remoteEventHandler > broadcast parity', () => {
|
||||
expect(reload).toHaveBeenCalledTimes(1);
|
||||
expect(reload).toHaveBeenCalledWith(5);
|
||||
});
|
||||
|
||||
it('FE-BCAST-027: a burst of tripTags:changed reads the tags of the open trip once, and none without a trip', () => {
|
||||
vi.useFakeTimers();
|
||||
const load = vi.fn(async () => undefined);
|
||||
useTripStore.setState({ loadTripTags: load });
|
||||
send({ type: 'tripTags:changed' });
|
||||
vi.advanceTimersByTime(300);
|
||||
expect(load).not.toHaveBeenCalled();
|
||||
|
||||
useTripStore.setState({ trip: buildTrip({ id: 5 }) });
|
||||
for (let i = 0; i < 3; i++) send({ type: 'tripTags:changed', tripId: 5 });
|
||||
expect(load).not.toHaveBeenCalled();
|
||||
vi.advanceTimersByTime(300);
|
||||
expect(load).toHaveBeenCalledTimes(1);
|
||||
expect(load).toHaveBeenCalledWith(5);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user