本文整理汇总了TypeScript中ng-metadata/testing.IRender类的典型用法代码示例。如果您正苦于以下问题:TypeScript IRender类的具体用法?TypeScript IRender怎么用?TypeScript IRender使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRender类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe( `AppComponent`, () => {
let render: IRender;
beforeEach( angular.mock.module( AppModule ) );
beforeEach( angular.mock.inject( ( $injector: ng.auto.IInjectorService ) => {
const $compile = $injector.get<ng.ICompileService>( '$compile' );
const $rootScope = $injector.get<ng.IRootScopeService>( '$rootScope' );
const $scope = $rootScope.$new();
render = renderFactory( $compile, $scope );
} ) );
it( `should render Hello Pluto!!!`, () => {
const { ctrl, compiledElement } = render( AppComponent );
expect( ctrl instanceof AppComponent ).toBe( true );
expect( compiledElement.text() ).toContain( 'Hello from Pluto!!!' );
} );
} );
示例2: describe
describe( `AppComponent`, () => {
@Component( {
selector: 'test-component',
directives: [ AppComponent ],
template: `<my-app></my-app>`
} )
class TestComponent {
}
const TestModule: string = bundle( TestComponent ).name;
let render: IRender<TestComponent>;
beforeEach( angular.mock.module( TestModule ) );
beforeEach( angular.mock.inject( ( $injector: ng.auto.IInjectorService ) => {
const $compile = $injector.get<ng.ICompileService>( '$compile' );
const $rootScope = $injector.get<ng.IRootScopeService>( '$rootScope' );
const $scope = $rootScope.$new();
render = renderFactory( $compile, $scope );
} ) );
it( `should render Hello Pluto!!!`, () => {
const {compiledElement} = render(TestComponent);
// now we need to get our tested component
const { debugElement, componentInstance } = queryByDirective( compiledElement, AppComponent );
expect( componentInstance instanceof AppComponent ).toBe( true );
expect( debugElement.text() ).toContain( 'Hello from Pluto!!!' );
} );
} );
示例3: it
it( `should render Hello Pluto!!!`, () => {
const { ctrl, compiledElement } = render( AppComponent );
expect( ctrl instanceof AppComponent ).toBe( true );
expect( compiledElement.text() ).toContain( 'Hello from Pluto!!!' );
} );
示例4: it
it( `should render Hello Pluto!!!`, () => {
const {compiledElement} = render(TestComponent);
// now we need to get our tested component
const { debugElement, componentInstance } = queryByDirective( compiledElement, AppComponent );
expect( componentInstance instanceof AppComponent ).toBe( true );
expect( debugElement.text() ).toContain( 'Hello from Pluto!!!' );
} );