refactor(devtools): add a demo resource to the demo app

Add a demo resource for testing purposes.
This commit is contained in:
hawkgs
2026-02-06 13:57:32 +02:00
committed by Andrew Kushnir
parent 460dbbb8e9
commit ce0f0febe2
3 changed files with 13 additions and 1 deletions
@@ -57,7 +57,7 @@ describe('Viewing component metadata', () => {
it('should display correct set of properties', () => {
cy.contains('.mat-accordion-content#Properties', 'Properties');
cy.contains('.mat-accordion-content#Properties mat-tree-node:first span:first', 'elementRef');
cy.contains('.mat-accordion-content#Properties mat-tree-node:first span:first', 'demoRsrc');
cy.contains('.mat-accordion-content#Properties mat-tree-node:last span:first', 'zippy');
});
});
@@ -9,3 +9,4 @@
<div *appStructural>Test Structural Directive</div>
<app-sample-properties></app-sample-properties>
<app-cookies />
<p>Resource value: {{ demoRsrc.value() }}</p>
@@ -12,10 +12,12 @@ import {
computed,
CUSTOM_ELEMENTS_SCHEMA,
Directive,
effect,
ElementRef,
inject,
input,
output,
resource,
signal,
TemplateRef,
viewChild,
@@ -79,6 +81,11 @@ export class DemoAppComponent {
return {...original, age: original.age + 1};
});
demoRsrc = resource({
defaultValue: 'default_value',
loader: () => new Promise((res) => setTimeout(() => res('loaded_value'), 5000)),
});
getTitle(): '► Click to expand' | '▼ Click to collapse' {
if (!this.zippy() || !this.zippy()?.visible) {
return '► Click to expand';
@@ -90,5 +97,9 @@ export class DemoAppComponent {
afterRenderEffect(() => {
this.zippy();
});
effect(() => {
this.demoRsrc.isLoading();
});
}
}