1515 * limitations under the License.
1616 */
1717
18+ import 'reflect-metadata/Reflect' ;
19+ import 'zone.js/dist/zone' ;
20+ import 'zone.js/dist/webapis-shadydom' ; // https://github.com/angular/zone.js/pull/784
21+ import 'zone.js/dist/long-stack-trace-zone' ;
22+ import 'zone.js/dist/proxy' ;
23+ import 'zone.js/dist/sync-test' ;
24+ import 'zone.js/dist/mocha-patch' ;
25+ import 'zone.js/dist/async-test' ;
26+ import 'zone.js/dist/fake-async-test' ;
27+ import { getTestBed } from '@angular/core/testing' ;
28+ import {
29+ BrowserDynamicTestingModule ,
30+ platformBrowserDynamicTesting
31+ } from '@angular/platform-browser-dynamic/testing' ;
1832import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core" ;
19- import { TestBed } from "@angular/core/testing" ;
20-
2133import {
22- ComponentWithoutChildren ,
2334 ComponentWithChildren ,
24- ComponentWithChildrenRerender ,
25- ComponentWithDifferentViews ,
26- ComponentWithProperties ,
27- ComponentWithUnregistered ,
28- ComponentWithImperativeEvent ,
29- ComponentWithDeclarativeEvent
30- } from "./components" ;
35+ ComponentWithChildrenRerender , ComponentWithDeclarativeEvent ,
36+ ComponentWithDifferentViews , ComponentWithImperativeEvent ,
37+ ComponentWithoutChildren , ComponentWithProperties , ComponentWithUnregistered
38+ } from "./src/components" ;
39+
40+ import basicTests from "basic-tests" ;
41+ import advancedTests from "advanced-tests" ;
42+
43+
44+ // Prevent Karma from running prematurely.
45+ __karma__ . loaded = function ( ) { } ;
46+
47+ // First, initialize the Angular testing environment.
48+ getTestBed ( ) . initTestEnvironment (
49+ BrowserDynamicTestingModule ,
50+ platformBrowserDynamicTesting ( )
51+ ) ;
52+ // Run basic and advanced tests through Karma
3153
32- import tests from 'basic-tests' ;
3354
3455beforeEach ( function ( ) {
35- TestBed . configureTestingModule ( {
56+ getTestBed ( ) . configureTestingModule ( {
3657 declarations : [
3758 ComponentWithoutChildren ,
3859 ComponentWithChildren ,
@@ -48,14 +69,14 @@ beforeEach(function() {
4869} ) ;
4970
5071function render ( Component ) {
51- const fixture = TestBed . createComponent ( Component ) ;
72+ const fixture = getTestBed ( ) . createComponent ( Component ) ;
5273 fixture . detectChanges ( ) ;
5374 const el = fixture . debugElement . nativeElement ;
5475 const wc = el . querySelector ( '#wc' ) ;
5576 return { wc, fixture }
5677}
5778
58- tests ( {
79+ const renderers = {
5980 renderComponentWithoutChildren ( ) {
6081 return render ( ComponentWithoutChildren ) ;
6182 } ,
@@ -86,5 +107,19 @@ tests({
86107 fixture . detectChanges ( ) ;
87108 }
88109 return { wc, fixture, click } ;
110+ } ,
111+ renderComponentWithDeclarativeEvent ( ) {
112+ const { wc, fixture } = render ( ComponentWithDeclarativeEvent ) ;
113+ function click ( ) {
114+ wc . click ( ) ;
115+ fixture . detectChanges ( ) ;
116+ }
117+ return { wc, fixture, click } ;
89118 }
90- } ) ;
119+ } ;
120+
121+ basicTests ( renderers ) ;
122+ advancedTests ( renderers ) ;
123+
124+ // Finally, start Karma to run the tests.
125+ __karma__ . start ( ) ;
0 commit comments