Skip to content

Commit 4576a19

Browse files
authored
fix: pre-release cleanup of review findings and tracker leftovers (#494)
Refs #368, #369, #370, #371, #373, #307
1 parent 07e5fab commit 4576a19

81 files changed

Lines changed: 1386 additions & 569 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/compat.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,31 @@ jobs:
102102
103103
- name: Test the page side
104104
run: pnpm exec vitest run --root packages/devtools --config vitest.compat.config.ts
105+
106+
vite:
107+
name: Vite ${{ matrix.vite }}
108+
runs-on: ubuntu-latest
109+
timeout-minutes: 15
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
# The `vite` peer range is `>=6`; the workspace installs the newest major.
114+
vite: ['6', '7']
115+
steps:
116+
- uses: actions/checkout@v7
117+
with:
118+
persist-credentials: false
119+
120+
- uses: ./.github/actions/setup
121+
122+
- name: Install Vite ${{ matrix.vite }}
123+
env:
124+
VITE_MAJOR: ${{ matrix.vite }}
125+
# Only this job's copy of the workspace changes; the committed lockfile stays as it is.
126+
run: |
127+
printf "\noverrides:\n vite: '^%s.0.0'\n" "$VITE_MAJOR" >> pnpm-workspace.yaml
128+
pnpm install --no-frozen-lockfile
129+
echo "- vite $(node -p "require('vite/package.json').version")" | tee -a "$GITHUB_STEP_SUMMARY"
130+
131+
- name: Test the Vite plugin
132+
run: pnpm exec vitest run --root packages/devtools src/__tests__/vite- src/__tests__/lan-address.test.ts

‎.github/workflows/docs-check.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
elif [ "$NO_DOCS" = "true" ]; then
3838
echo "Code changed without docs, marked no-docs."
3939
else
40-
echo "::warning title=Docs not updated::This pull request changes code but no page in apps/docs/src/content. Update the docs in this pull request, or add the no-docs label and say why in the description."
40+
echo "::error title=Docs not updated::This pull request changes code but no page in apps/docs/src/content. Update the docs in this pull request, or add the no-docs label and say why in the description."
4141
printf '%s\n' "$code"
42+
exit 1
4243
fi

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ By taking part you agree to the [Code of Conduct](./CODE_OF_CONDUCT.md). Report
2929
- **A new tab, RPC function or agent tool:** follow the steps in [Development setup](./apps/docs/src/content/contributing/development.md). Describe what an agent tool returns and when it is empty, and add tests.
3030
- **UI changes:** follow the [UI guidelines](docs/contributing/ui-guidelines.md). Use the theme variables, the SCSS mixins and the shared dropdown.
3131
- **Docs changes:** follow the [writing guide](./apps/docs/src/content/contributing/writing-docs.md). Run the docs site with `pnpm docs:dev`.
32-
- **Keep the docs in step with the code:** when a pull request changes behaviour, an option, a UI label or an agent tool, update the matching page in `apps/docs` in the same pull request. If no docs change is needed, add the `no-docs` label and say why in the description. The Docs check workflow warns when code changes without docs.
32+
- **Keep the docs in step with the code:** when a pull request changes behaviour, an option, a UI label or an agent tool, update the matching page in `apps/docs` in the same pull request. If no docs change is needed, add the `no-docs` label and say why in the description. The Docs check workflow fails when code changes without docs.
3333

3434
## Open an issue
3535

‎app/src/__tests__/analog-views.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,38 @@ describe('Analog Nitro tasks', () => {
317317
expect((fixture.nativeElement as HTMLElement).textContent).toContain('[redacted]');
318318
});
319319

320+
it('keeps the confirm panel and payload open when a run fails, and closes it after a run that works', async () => {
321+
let ok = false;
322+
const { rpcClient } = client({
323+
'analog-runtime-config': () => ({ env: [], runtimeConfig: [], options: [] }),
324+
'analog-nitro': () => ({
325+
plugins: [],
326+
tasks: [{ name: 'db:migrate', file: '/src/server/tasks/db/migrate.ts' }],
327+
storage: [],
328+
cachedRules: [],
329+
cacheDirs: [],
330+
entries: [],
331+
notes: [],
332+
}),
333+
'analog-run-nitro-task': () =>
334+
ok
335+
? { ok: true, name: 'db:migrate', status: 200, ms: 1, output: '' }
336+
: { ok: false, name: 'db:migrate', error: 'Task failed.' },
337+
});
338+
const fixture = TestBed.createComponent(AnalogRuntime);
339+
fixture.componentRef.setInput('rpc', rpcClient);
340+
await settle(fixture);
341+
const runtime = fixture.componentInstance;
342+
runtime.askTask('db:migrate');
343+
runtime.taskPayload.set('{"dry":true}');
344+
await runtime.runTask('db:migrate');
345+
expect(runtime.taskConfirm()).toBe('db:migrate');
346+
expect(runtime.taskPayload()).toBe('{"dry":true}');
347+
ok = true;
348+
await runtime.runTask('db:migrate');
349+
expect(runtime.taskConfirm()).toBeNull();
350+
});
351+
320352
it('starts a task once, even when Run task is used again while it runs', async () => {
321353
let answer!: (value: unknown) => void;
322354
const { rpcClient, calls } = client({

‎app/src/__tests__/app-shell.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,22 @@ describe('App scroll memory while content loads', () => {
404404
});
405405
});
406406

407+
describe('App connection error', () => {
408+
it('links to the troubleshooting docs when it cannot reach the server', async () => {
409+
const fixture = TestBed.createComponent(App);
410+
document.body.appendChild(host(fixture));
411+
await settle(fixture);
412+
fixture.componentInstance.connectionFailed.set(true);
413+
await settle(fixture);
414+
const link = host(fixture).querySelector<HTMLAnchorElement>('.connection-error a')!;
415+
expect(link.getAttribute('href')).toBe(
416+
'https://pangular-inspector.dev/getting-started/troubleshooting/#the-panel-says-disconnected',
417+
);
418+
expect(link.getAttribute('rel')).toBe('noopener noreferrer');
419+
fixture.destroy();
420+
});
421+
});
422+
407423
describe('App counts launcher setting', () => {
408424
it('sends the stored counts launcher to the popup once the panel connects', async () => {
409425
localStorage.setItem('pangular-pref:pill', 'true');

‎app/src/__tests__/component-pick-keys.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ describe('keyboard pick', () => {
6565
expect(fixture.componentInstance.announcement()).toBe(
6666
'App <app-root>. Press Enter to pick it.',
6767
);
68+
// The same component again changes the live text, so a screen reader repeats it.
69+
press('ArrowDown');
70+
await settle(fixture);
71+
expect(fixture.componentInstance.announcement()).toBe(
72+
'App <app-root>. Press Enter to pick it.\u00a0',
73+
);
74+
expect(fixture.componentInstance.pickMessage()).toBe('App <app-root>. Press Enter to pick it.');
6875
expect(press('Enter').defaultPrevented).toBe(true);
6976
expect(calls.at(-1)).toEqual({
7077
name: 'request-component-pick-move',

‎app/src/__tests__/page-conventions.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,31 @@ describe('pages use the shared state component', () => {
110110
for (const { file, tag } of states) expect(tag, file).toMatch(/\(clear\)=/);
111111
});
112112
});
113+
114+
describe('pages with a keyboard list use the shared roving list', () => {
115+
it('has no hand-written arrow key list handler left in a page', async () => {
116+
// Trees, charts and the graph move in two dimensions and keep their own keys.
117+
const handWritten = [...(await pageSources())]
118+
.filter(([, source]) => /\['ArrowDown',\s*'ArrowUp',\s*'Home',\s*'End'\]/.test(source))
119+
.map(([file]) => file);
120+
expect(handWritten).toEqual([]);
121+
});
122+
123+
it('puts appRovingList on the lists that moved to it', async () => {
124+
const sources = await pageSources();
125+
const lists = {
126+
'capacitor-inspector.ts': '[data-cap-call]',
127+
'pipes-inspector.ts': '[data-pipe-row]',
128+
'network-inspector.ts': '',
129+
'query-inspector.ts': '',
130+
'signal-inspector.ts': '',
131+
'store-inspector.ts': '',
132+
'timeline.ts': '',
133+
};
134+
for (const [file, selector] of Object.entries(lists)) {
135+
const source = sources.get(file) ?? '';
136+
expect(source, file).toContain('appRovingList="');
137+
if (selector) expect(source, file).toContain(`appRovingList="${selector}"`);
138+
}
139+
});
140+
});

‎app/src/__tests__/pipes-record-page.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,32 @@ describe('pipes live data per page', () => {
166166
expect(fixture.componentInstance.liveFor('price')?.instanceCount).toBe(2);
167167
});
168168

169+
it('shows the page another tab asked for over the page the panel belongs to', async () => {
170+
scopeToPage('A');
171+
const fixture = TestBed.createComponent(PipesInspector);
172+
fixture.componentRef.setInput('pageId', 'B');
173+
fixture.componentRef.setInput(
174+
'rpc',
175+
withPages({
176+
pipes: [live(5)],
177+
async: [],
178+
reportedAt: 0,
179+
instrumented: [],
180+
pages: [
181+
{ pageId: 'A', pipes: [live(3)], async: [] },
182+
{ pageId: 'B', pipes: [live(2)], async: [] },
183+
],
184+
}),
185+
);
186+
for (let i = 0; i < 4; i++) {
187+
await new Promise((resolve) => setTimeout(resolve));
188+
await fixture.whenStable();
189+
}
190+
expect(fixture.componentInstance.liveFor('price')?.instanceCount).toBe(2);
191+
fixture.componentRef.setInput('pageId', null);
192+
expect(fixture.componentInstance.liveFor('price')?.instanceCount).toBe(3);
193+
});
194+
169195
it('lists the template usages of a custom pipe', async () => {
170196
const fixture = await render(
171197
withPages({ pipes: [], async: [], reportedAt: 0, instrumented: [] }),

‎app/src/__tests__/popout-window.test.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it, vi } from 'vitest';
2-
import { popoutOpener, returnFromPopout } from '../shell-prefs';
2+
import { popoutOpener, postToOpener, returnFromPopout } from '../shell-prefs';
33

44
/** A stand-in for a window, with the fields the helpers read. */
55
function fakeWindow(name: string, opener: unknown, referrer = '') {
@@ -42,4 +42,13 @@ describe('the pop-out window', () => {
4242
);
4343
expect(returnFromPopout(fakeWindow('pangular-inspector-k3x9', opener))).toBe(false);
4444
});
45+
46+
it('sends a setting to the app page only from the window the popup opened', () => {
47+
const opener = { postMessage: vi.fn(), location: { origin: 'http://localhost:4200' } };
48+
const message = { type: 'pangular:popup-pill', pill: true };
49+
expect(postToOpener(message, fakeWindow('pangular-inspector-k3x9', opener))).toBe(true);
50+
expect(opener.postMessage).toHaveBeenCalledWith(message, 'http://localhost:4200');
51+
expect(postToOpener(message, fakeWindow('other', opener))).toBe(false);
52+
expect(opener.postMessage).toHaveBeenCalledTimes(1);
53+
});
4554
});

‎app/src/__tests__/roving-list.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ describe('RovingList', () => {
5959
expect(tabStops(fixture)).toEqual(['c']);
6060
});
6161

62+
it('moves the Tab stop to a row that becomes selected without focus', async () => {
63+
const fixture = mount();
64+
await settle(fixture);
65+
expect(tabStops(fixture)).toEqual(['a']);
66+
// A click in Safari selects a row without focusing it.
67+
fixture.componentInstance.selected.set('c');
68+
await settle(fixture);
69+
expect(tabStops(fixture)).toEqual(['c']);
70+
});
71+
72+
it('keeps the Tab stop when a row that stays selected changes another class', async () => {
73+
const fixture = mount();
74+
const outside = document.createElement('button');
75+
document.body.appendChild(outside);
76+
fixture.componentInstance.selected.set('c');
77+
await settle(fixture);
78+
rows(fixture)[0].focus();
79+
outside.focus();
80+
await settle(fixture);
81+
expect(tabStops(fixture)).toEqual(['a']);
82+
rows(fixture)[2].classList.add('hovered');
83+
await settle(fixture);
84+
expect(tabStops(fixture)).toEqual(['a']);
85+
});
86+
6287
it('moves focus with the arrow keys, Home and End, and stops at the ends', async () => {
6388
const fixture = mount();
6489
await settle(fixture);

0 commit comments

Comments
 (0)