mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(docs-infra): fix broken adev tests (#64761)
Fixes some adev tests that are broken on main. PR Close #64761
This commit is contained in:
parent
2edc82abe0
commit
9123e3d445
3 changed files with 13 additions and 17 deletions
|
|
@ -14,6 +14,7 @@ import {NodeRuntimeSandbox} from '../../editor/node-runtime-sandbox.service';
|
|||
|
||||
import TutorialPlayground from './playground.component';
|
||||
import {provideRouter} from '@angular/router';
|
||||
import {mockAsyncProvider} from '../../core/services/inject-async';
|
||||
|
||||
describe('TutorialPlayground', () => {
|
||||
let component: TutorialPlayground;
|
||||
|
|
@ -26,6 +27,14 @@ describe('TutorialPlayground', () => {
|
|||
};
|
||||
|
||||
beforeEach(() => {
|
||||
class FakeEmbeddedTutorialManager {
|
||||
fetchAndSetTutorialFiles() {}
|
||||
}
|
||||
|
||||
class FakeNodeRuntimeSandbox {
|
||||
init() {}
|
||||
}
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TutorialPlayground],
|
||||
providers: [
|
||||
|
|
@ -34,18 +43,8 @@ describe('TutorialPlayground', () => {
|
|||
provide: WINDOW,
|
||||
useValue: fakeWindow,
|
||||
},
|
||||
{
|
||||
provide: EmbeddedTutorialManager,
|
||||
useValue: {
|
||||
fetchAndSetTutorialFiles: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: NodeRuntimeSandbox,
|
||||
useVaue: {
|
||||
init: () => {},
|
||||
},
|
||||
},
|
||||
mockAsyncProvider(NodeRuntimeSandbox, FakeNodeRuntimeSandbox),
|
||||
mockAsyncProvider(EmbeddedTutorialManager, FakeEmbeddedTutorialManager),
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export default class PlaygroundComponent {
|
|||
)
|
||||
.subscribe(() => {
|
||||
this.changeDetectorRef.markForCheck();
|
||||
this.nodeRuntimeSandbox!.init();
|
||||
this.nodeRuntimeSandbox?.init();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ export default class PlaygroundComponent {
|
|||
});
|
||||
this.selectedTemplate = template;
|
||||
await this.loadTemplate(template.path);
|
||||
await this.nodeRuntimeSandbox!.reset();
|
||||
await this.nodeRuntimeSandbox?.reset();
|
||||
}
|
||||
|
||||
private async loadTemplate(tutorialPath: string) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import ApiItemLabel from './api-item-label.component';
|
|||
import {ApiItemType} from '../interfaces/api-item-type';
|
||||
|
||||
describe('ApiItemLabel', () => {
|
||||
let component: ApiItemLabel;
|
||||
let fixture: ComponentFixture<ApiItemLabel>;
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
@ -20,12 +19,10 @@ describe('ApiItemLabel', () => {
|
|||
imports: [ApiItemLabel],
|
||||
});
|
||||
fixture = TestBed.createComponent(ApiItemLabel);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should by default display short label for Class', () => {
|
||||
fixture.componentRef.setInput('type', ApiItemType.CLASS);
|
||||
fixture.componentRef.setInput('mode', 'short');
|
||||
fixture.detectChanges();
|
||||
|
||||
const label = fixture.nativeElement.innerText;
|
||||
|
|
|
|||
Loading…
Reference in a new issue