mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 19:40:34 +00:00
test: hold the audit follow-ups to the test, lint, theme and size ratchets
The packing row tests read the TREK tooltip and the accessible name instead of the title the badges no longer carry, the journey delete suite takes its service from the module over a snapshot db and seeds through the row factories, the storage notifier suite builds its subject once, the POI layer follows the view only while it has POIs, the collections repository reads the list's places through its own query, and the baselines the moved code left smaller come down with it.
This commit is contained in:
@@ -48,7 +48,7 @@ describe('BringersCard', () => {
|
||||
expect(rows).toHaveLength(2);
|
||||
expect(rows[0]).toHaveTextContent('anna');
|
||||
expect(rows[1]).toHaveTextContent('carla');
|
||||
expect(screen.getByText('packing.bringersTitle')).toBeInTheDocument();
|
||||
expect(screen.getByText('Brought by')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-PACK-BRINGERCARD-004: the "+N" circle counts the others', () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ export function BringerAvatar({ bringer }: { bringer: Bringer }) {
|
||||
style={{
|
||||
...CIRCLE,
|
||||
background: `hsl(${((bringer.name.codePointAt(0) ?? 0) * 37) % 360}, 55%, 55%)`, // theme-lint-disable: the colour comes from the bringer's name
|
||||
color: 'white', // theme-lint-disable: the letter sits on the name's own colour
|
||||
color: 'white',
|
||||
textTransform: 'uppercase',
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -379,13 +379,16 @@ describe('ArtikelZeile — category picker', () => {
|
||||
})
|
||||
|
||||
describe('ArtikelZeile — sharing badges', () => {
|
||||
it('FE-W5ROW-018: an item somebody else brings shows their name', () => {
|
||||
it('FE-W5ROW-018: an item somebody else brings shows their name in the TREK tooltip', async () => {
|
||||
setup({
|
||||
item: buildPackingItem({ id: 1, name: 'Stove', is_private: 1, owner_id: 2, owner_username: 'Bob' } as Partial<PackingItem>),
|
||||
currentUserId: 1,
|
||||
})
|
||||
|
||||
expect(screen.getByLabelText('by Bob')).toHaveAttribute('title', 'by Bob')
|
||||
const badge = screen.getByLabelText('by Bob')
|
||||
expect(badge).not.toHaveAttribute('title')
|
||||
fireEvent.mouseEnter(badge)
|
||||
expect(await screen.findByRole('tooltip')).toHaveTextContent('by Bob')
|
||||
})
|
||||
|
||||
it('FE-W5ROW-019: a nameless bringer degrades to an empty name', () => {
|
||||
@@ -394,10 +397,10 @@ describe('ArtikelZeile — sharing badges', () => {
|
||||
currentUserId: 1,
|
||||
})
|
||||
|
||||
expect(screen.getByTitle('by')).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('by')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-W5ROW-020: an item shared by me counts its recipients', () => {
|
||||
it('FE-W5ROW-020: an item shared by me counts its recipients', async () => {
|
||||
setup({
|
||||
item: buildPackingItem({
|
||||
id: 1, name: 'Stove', is_private: 1, owner_id: 1,
|
||||
@@ -407,10 +410,11 @@ describe('ArtikelZeile — sharing badges', () => {
|
||||
})
|
||||
|
||||
expect(screen.getByLabelText('shared with 2')).toHaveTextContent('2')
|
||||
expect(screen.getByTitle('shared with 2: alice, bob')).toBeInTheDocument()
|
||||
fireEvent.mouseEnter(screen.getByLabelText('shared with 2'))
|
||||
expect(await screen.findByRole('tooltip')).toHaveTextContent('shared with 2: alice, bob')
|
||||
})
|
||||
|
||||
it('FE-W5ROW-021: a common item names its bringer and counts co-bringers', () => {
|
||||
it('FE-W5ROW-021: a common item names its bringer and counts co-bringers', async () => {
|
||||
setup({
|
||||
item: buildPackingItem({
|
||||
id: 1, name: 'Stove', is_private: 0, owner_username: 'Bob',
|
||||
@@ -419,8 +423,15 @@ describe('ArtikelZeile — sharing badges', () => {
|
||||
currentUserId: 1,
|
||||
})
|
||||
|
||||
// The bringer's initial on an avatar, the co-bringers as a count; the title names everyone (#2782).
|
||||
expect(screen.getByTitle('brought by Bob, cleo')).toHaveTextContent('B+1')
|
||||
// The bringer's initial on an avatar, the co-bringers as a "+N" circle; the tooltip
|
||||
// names everyone, each on a line of their own (#2782).
|
||||
const badge = screen.getByLabelText('brought by Bob, cleo')
|
||||
expect(badge).toHaveTextContent('B+1')
|
||||
fireEvent.mouseEnter(badge)
|
||||
const rows = within(await screen.findByRole('tooltip')).getAllByRole('listitem')
|
||||
expect(rows).toHaveLength(2)
|
||||
expect(rows[0]).toHaveTextContent('Bob')
|
||||
expect(rows[1]).toHaveTextContent('cleo')
|
||||
})
|
||||
|
||||
it('FE-W5ROW-022: a bringer without co-bringers shows no counter', () => {
|
||||
@@ -429,7 +440,7 @@ describe('ArtikelZeile — sharing badges', () => {
|
||||
currentUserId: 1,
|
||||
})
|
||||
|
||||
expect(screen.getByTitle('brought by Bob')).toHaveTextContent(/^B$/)
|
||||
expect(screen.getByLabelText('brought by Bob')).toHaveTextContent(/^B$/)
|
||||
})
|
||||
|
||||
it('FE-W5ROW-023: the placeholder row carries no badges and no share control', () => {
|
||||
|
||||
Reference in New Issue
Block a user