|
12 | 12 | * harness), with `owner_id` declared 5th in `highlightFields`, behind four |
13 | 13 | * non-text highlights (so the phone subtitle takes none of them): |
14 | 14 | * |
15 | | - * - at 390 px the phone header draws four highlights after its subtitle, so |
16 | | - * the owner is not in the strip and the meta line names it; |
17 | | - * - at 1440 px the strip draws all five, the owner among them, and the meta |
18 | | - * line leaves it out (objectstack#28868, the owner once). |
| 15 | + * - until objectstack#35891 the phone header drew four highlights (the |
| 16 | + * owner past them, so the meta line named it) and the desktop strip all |
| 17 | + * five (the strip named the owner, the meta line did not); |
| 18 | + * - the default page draws no strip now, so at 390 px and at 1440 px the |
| 19 | + * meta line names the owner. |
19 | 20 | */ |
20 | 21 |
|
21 | 22 | import * as React from 'react'; |
@@ -138,17 +139,15 @@ function mountPage() { |
138 | 139 | ); |
139 | 140 | } |
140 | 141 |
|
141 | | -/** The strip and the meta line, once both are drawn. */ |
142 | | -async function stripAndMetaLine(): Promise<{ strip: HTMLElement; metaLine: HTMLElement }> { |
| 142 | +/** The meta line, once the record has loaded. */ |
| 143 | +async function metaLineLoaded(): Promise<HTMLElement> { |
143 | 144 | return waitFor( |
144 | 145 | () => { |
145 | | - const strip = document.querySelector('[data-highlights-face]') as HTMLElement | null; |
146 | 146 | const metaLine = document.querySelector('[data-testid="record-meta-footer"]') as HTMLElement | null; |
147 | | - expect(strip).toBeTruthy(); |
148 | 147 | expect(metaLine).toBeTruthy(); |
149 | | - // The record has loaded: the strip shows its values. |
150 | | - expect(strip!.textContent).toContain('mira@atlas.test'); |
151 | | - return { strip: strip!, metaLine: metaLine! }; |
| 148 | + // The record has loaded: its values are on the page. |
| 149 | + expect(document.body.textContent).toContain('mira@atlas.test'); |
| 150 | + return metaLine!; |
152 | 151 | }, |
153 | 152 | { timeout: 5000 }, |
154 | 153 | ); |
@@ -180,24 +179,22 @@ afterEach(() => { |
180 | 179 | }); |
181 | 180 |
|
182 | 181 | describe('the owner at every width, once (objectstack#28909)', () => { |
183 | | - it('on a phone: owner_id declared 5th is past the header\'s four, so the meta line names the owner', async () => { |
| 182 | + // Until objectstack#35891 the default page drew a strip of the declared |
| 183 | + // highlights: four on a phone (the owner past them, so the meta line named |
| 184 | + // it) and all five on a desktop (the strip named the owner, the meta line |
| 185 | + // did not). The default page draws no strip now, at any width, so the meta |
| 186 | + // line names the owner at both. |
| 187 | + it.each([ |
| 188 | + ['a phone', 390], |
| 189 | + ['a desktop', 1440], |
| 190 | + ])('on %s: no strip, and the meta line names the owner', async (_face, width) => { |
| 191 | + setWidth(width); |
184 | 192 | mountPage(); |
185 | | - const { strip, metaLine } = await stripAndMetaLine(); |
186 | | - // The phone header: four highlights, the owner not among them. |
187 | | - expect(strip.children).toHaveLength(4); |
188 | | - expect(strip.textContent).not.toContain('Ada Admin'); |
| 193 | + const metaLine = await metaLineLoaded(); |
| 194 | + expect(document.querySelector('[data-highlights-face]')).toBeNull(); |
189 | 195 | const owner = ownerEntry(metaLine); |
190 | 196 | expect(owner).toBeTruthy(); |
191 | 197 | expect(owner!.textContent).toContain('Ada Admin'); |
192 | | - }); |
193 | | - |
194 | | - it('on a desktop: the strip names the owner and the meta line does not', async () => { |
195 | | - setWidth(1440); |
196 | | - mountPage(); |
197 | | - const { strip, metaLine } = await stripAndMetaLine(); |
198 | | - expect(strip.children).toHaveLength(5); |
199 | | - expect(strip.textContent).toContain('Ada Admin'); |
200 | | - expect(ownerEntry(metaLine)).toBeNull(); |
201 | 198 | // The rest of the meta line is still drawn. |
202 | 199 | expect(metaLine.querySelector('[data-record-meta-id]')!.textContent).toBe('r-1'); |
203 | 200 | }); |
|
0 commit comments