जब अचल ब्राउज़र में जैस्मीन चल मैंने देखा है कि TestBed
स्थिरता घटक डोम में नष्ट हो जाता है नहीं और बनी रहती है के बाद परीक्षण समाप्त हो:कोणीय 4 स्थिरता घटक डोम में बनी रहती है के दौरान जैस्मीन परीक्षण
यहाँ एक परीक्षण किया है घटक:
@Component({
selector: 'test-app',
template: `<div>Test</div>`,
})
class Test {}
और एक परीक्षण (plunk)।
let component;
let fixture;
let element;
beforeAll(() => {
TestBed.resetTestEnvironment();
TestBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
});
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [Test],
})
.compileComponents();
fixture = TestBed.createComponent(Test);
component = fixture.componentInstance;
element = fixture.debugElement.query(By.css('div')).nativeElement;
fixture.detectChanges();
});
afterEach(() => {
fixture.destroy();
});
it('should compile Test',() => {
expect(element).toBeTruthy();
});
क्यों Test
घटक उदाहरण डोम से न निकले और यह कैसे तय किया जाना चाहिए?
डीओएम में स्थिरता घटक क्यों जोड़े गए हैं? क्या उन्हें एंगुलरजेएस में $rootElement
जैसे डीओएम से अलग किया जा सकता है?
धन्यवाद, प्रश्नों में से एक जवाब, * यह कैसे तय किया जाना चाहिए * सवालों के बाकी अभी भी प्रासंगिक – estus