()
| 20 | describe('Preview', () => { |
| 21 | // Before each is used as a callable function to prevent conflicts between tests |
| 22 | const beforeEach = () => { |
| 23 | const PREVIEW_URL = 'https://angular.dev/'; |
| 24 | |
| 25 | const fakeNodeRuntimeSandbox: Partial<NodeRuntimeSandbox> = { |
| 26 | previewUrl$: of(PREVIEW_URL), |
| 27 | }; |
| 28 | |
| 29 | const fakeNodeRuntimeState = { |
| 30 | loadingStep: signal(LoadingStep.NOT_STARTED), |
| 31 | error: signal<NodeRuntimeError | undefined>(undefined), |
| 32 | }; |
| 33 | |
| 34 | TestBed.configureTestingModule({ |
| 35 | imports: [Preview], |
| 36 | providers: [ |
| 37 | { |
| 38 | provide: NodeRuntimeSandbox, |
| 39 | useValue: fakeNodeRuntimeSandbox, |
| 40 | }, |
| 41 | { |
| 42 | provide: NodeRuntimeState, |
| 43 | useValue: fakeNodeRuntimeState, |
| 44 | }, |
| 45 | ], |
| 46 | }); |
| 47 | |
| 48 | const fixture = TestBed.createComponent(Preview); |
| 49 | |
| 50 | const component = fixture.componentInstance; |
| 51 | const iframeElement = fixture.debugElement.query(By.css('iframe')); |
| 52 | |
| 53 | return { |
| 54 | fixture, |
| 55 | component, |
| 56 | iframeElement, |
| 57 | PREVIEW_URL, |
| 58 | fakeNodeRuntimeState, |
| 59 | fakeNodeRuntimeSandbox, |
| 60 | getLoadingElementsWrapper: () => |
| 61 | fixture.debugElement.query(By.css('adev-embedded-editor-preview-loading')), |
| 62 | }; |
| 63 | }; |
| 64 | |
| 65 | it('should set iframe src', async () => { |
| 66 | const {fixture, PREVIEW_URL} = beforeEach(); |
no test coverage detected
searching dependent graphs…