Skip to content

Commit 30226d4

Browse files
committed
test(ui): give JIT the signal inputs of the live and sort controls
The package tests render the SSR & HTTP and Store pages without the AOT compiler, so JIT never saw the signal inputs of LiveControls and SortHeader and threw NG0950. The tests now add the input metadata, the way they already do for Select and the store tabs.
1 parent 03898a6 commit 30226d4

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎packages/devtools/src/__tests__/network-inspector.test.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
// @vitest-environment jsdom
22
import '@angular/compiler';
3-
import { Component, EventEmitter } from '@angular/core';
3+
import { Component, EventEmitter, Input, Output } from '@angular/core';
44
import { TestBed, type ComponentFixture } from '@angular/core/testing';
55
import { afterEach, describe, expect, it } from 'vitest';
66
import { NetworkInspector } from '../../../../app/src/pages/network-inspector.ts';
77
import { Select } from '../../../../app/src/ui/select.ts';
8+
import { LiveControls } from '../../../../app/src/ui/live-feed.ts';
9+
import { SortHeader } from '../../../../app/src/ui/sort-header.ts';
810
import { initAngularTestBed } from './angular-version.ts';
911

1012
initAngularTestBed();
1113

14+
// JIT sees signal inputs only through the metadata the AOT compiler would write.
15+
const signalInput = (name: string, alias = name, required = false) => [
16+
{ type: Input, args: [{ isSignal: true, alias, required }] },
17+
];
18+
(LiveControls as unknown as { propDecorators: unknown }).propDecorators = {
19+
feed: signalInput('feed', 'feed', true),
20+
what: signalInput('what', 'what', true),
21+
};
22+
// `sort` is a model(): an input plus a `sortChange` output on the same property.
23+
(SortHeader as unknown as { propDecorators: unknown }).propDecorators = {
24+
column: signalInput('column', 'appSortHeader', true),
25+
sort: [...signalInput('sort'), { type: Output, args: ['sortChange'] }],
26+
};
27+
1228
class StubSelect {
1329
valueChange = new EventEmitter<string | null>();
1430
}

‎packages/devtools/src/__tests__/store-inspector.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ async function mount() {
1313
const { EntryTabs } = await import('../../../../app/src/pages/store-entry-tabs.ts');
1414
const { StoreSession } = await import('../../../../app/src/pages/store-session.ts');
1515
const { Select } = await import('../../../../app/src/ui/select.ts');
16+
const { LiveControls } = await import('../../../../app/src/ui/live-feed.ts');
1617
(StoreInspector as unknown as { propDecorators: unknown }).propDecorators = Object.fromEntries(
1718
['stateTree', 'latestButton', 'cancelButton', 'restoreButton'].map((name) => [
1819
name,
@@ -39,6 +40,7 @@ async function mount() {
3940
['seq', 'idPrefix', 'loader'],
4041
);
4142
signalInputs(StoreSession, ['rpc', 'pageId', 'storeId', 'entries']);
43+
signalInputs(LiveControls, ['feed', 'what'], ['feed', 'what']);
4244
signalInputs(
4345
Select,
4446
[

0 commit comments

Comments
 (0)