Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ngDebugDependencyInjectionApiIsSupported,
ngDebugProfilerApiIsSupported,
ngDebugRoutesApiIsSupported,
ngDebugSignalGraphApiIsSupported,
} from './ng-debug-api';
import {Framework} from '../component-tree/core-enums';

Expand Down Expand Up @@ -113,4 +114,24 @@ describe('ng-debug-api', () => {
expect(ngDebugRoutesApiIsSupported()).toBeFalse();
});
});

describe('ngDebugSignalGraphIsSupported', () => {
beforeEach(() => mockRoot());

it('should support Signal Graph API with getSignalGraph', () => {
(globalThis as any).ng = fakeNgGlobal(Framework.Angular);
(globalThis as any).ng.ɵgetSignalGraph = () => {};
expect(ngDebugSignalGraphApiIsSupported()).toBeTrue();
});

it('should not support Signal Graph API with no getSignalGraph', () => {
(globalThis as any).ng = fakeNgGlobal(Framework.ACX);
(globalThis as any).ng.ɵgetSignalGraph = 'not implemented';
expect(ngDebugSignalGraphApiIsSupported()).toBeFalse();

(globalThis as any).ng = fakeNgGlobal(Framework.ACX);
(globalThis as any).ng.ɵgetSignalGraph = undefined;
expect(ngDebugSignalGraphApiIsSupported()).toBeFalse();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@ export function ngDebugRoutesApiIsSupported(): boolean {
})
);
}

/** Checks whether Signal Graph API is supported within window.ng */
export function ngDebugSignalGraphApiIsSupported(): boolean {
const ng = ngDebugClient();
return ngDebugApiIsSupported(ng, 'ɵgetSignalGraph');
}
Comment thread
milomg marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ngDebugDependencyInjectionApiIsSupported,
ngDebugProfilerApiIsSupported,
ngDebugRoutesApiIsSupported,
ngDebugSignalGraphApiIsSupported,
} from './ng-debug-api';

/**
Expand All @@ -22,10 +23,12 @@ export function getSupportedApis(): SupportedApis {
const profiler = ngDebugProfilerApiIsSupported();
const dependencyInjection = ngDebugDependencyInjectionApiIsSupported();
const routes = ngDebugRoutesApiIsSupported();
const signals = ngDebugSignalGraphApiIsSupported();

return {
profiler,
dependencyInjection,
routes,
signals,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class DevToolsComponent implements OnDestroy {
profiler: false,
dependencyInjection: false,
routes: false,
signals: false,
});
readonly ivy = signal<boolean | undefined>(undefined);

Expand Down
1 change: 1 addition & 0 deletions devtools/projects/protocol/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ export interface SupportedApis {
profiler: boolean;
dependencyInjection: boolean;
routes: boolean;
signals: boolean;
}

export interface Events {
Expand Down