feat(core): add initial view engine (#14014)
The new view engine allows our codegen to produce less code, as it can interpret view definitions during runtime. The view engine is not feature complete yet, but already allows to implement a tree benchmark based on it. Part of #14013
This commit is contained in:

committed by
Alex Rickabaugh

parent
9d8c467cb0
commit
2f87eb52fe
36
modules/@angular/core/test/view/helper.ts
Normal file
36
modules/@angular/core/test/view/helper.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {RootRenderer} from '@angular/core';
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
export function isBrowser() {
|
||||
return getDOM().supportsDOMEvents();
|
||||
}
|
||||
|
||||
export function setupAndCheckRenderer(config: {directDom: boolean}) {
|
||||
let rootRenderer: any;
|
||||
if (config.directDom) {
|
||||
beforeEach(() => {
|
||||
rootRenderer = <any>{
|
||||
renderComponent: jasmine.createSpy('renderComponent')
|
||||
.and.throwError('Renderer should not have been called!')
|
||||
};
|
||||
TestBed.configureTestingModule(
|
||||
{providers: [{provide: RootRenderer, useValue: rootRenderer}]});
|
||||
});
|
||||
afterEach(() => { expect(rootRenderer.renderComponent).not.toHaveBeenCalled(); });
|
||||
} else {
|
||||
beforeEach(() => {
|
||||
rootRenderer = TestBed.get(RootRenderer);
|
||||
spyOn(rootRenderer, 'renderComponent').and.callThrough();
|
||||
});
|
||||
afterEach(() => { expect(rootRenderer.renderComponent).toHaveBeenCalled(); });
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user