【发布时间】:2020-07-28 06:44:25
【问题描述】:
这段代码正在运行,对我来说这是一种奇怪的行为,因为不应该提升 'const' 变量。有人能解释一下它的工作原理和原因吗?
describe("should dummy tests", () => {
let fixture: ComponentFixture<DummyComponent>;
let component: DummyComponent;
let element: HTMLElement;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: declarations
}).compileComponents();
fixture = TestBed.createComponent(DummyComponent);
component = fixture.componentInstance;
element = fixture.nativeElement as HTMLElement;
fixture.detectChanges();
});
it("should dummy text", async () => {
expect(element.querySelector("dummy-selector")).toBeTruthy();
});
});
const declarations = [DummyComponent];
【问题讨论】:
标签: javascript angular testing ecmascript-6 jestjs