0
我只想啓動TestBed,所以我可以使用TestBed函數。我在我的src/test.spec.ts嘗試這一點,它不工作:如何讓Angular 2最終(2.0.0,rc7之後)和TestBed在這個Plunkr中工作?
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
我也試着做了System.import的測試牀,並沒有奏效。例如,這在index.html中不能用作腳本標記。
Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
]).then(function (providers) {
var testing = providers[0];
var testingBrowser = providers[1];
testing.TestBed.initTestEnvironment(testingBrowser.BrowserDynamicTestingModule,
testingBrowser.platformBrowserDynamicTesting());
}).then(function() {
return Promise.all(
return System.import(app/test.spec.ts); //"app" stands for // './src' in the config.js file for SystemJS
);
})
這裏是Plunkr: https://plnkr.co/edit/K0IyBnR8F4F7zOp6LETi?p=preview
謝謝sooooo多!我沒有足夠的聲譽給你最好的答案。 – coder
不客氣! – yurzui
你好yurzui,你能告訴我,如果模板上的子組件必須更新,plunkr是如何工作的。 – coder