当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript SchematicTestRunner.runSchematicAsync方法代码示例

本文整理汇总了TypeScript中@angular-devkit/schematics/testing.SchematicTestRunner.runSchematicAsync方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SchematicTestRunner.runSchematicAsync方法的具体用法?TypeScript SchematicTestRunner.runSchematicAsync怎么用?TypeScript SchematicTestRunner.runSchematicAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular-devkit/schematics/testing.SchematicTestRunner的用法示例。


在下文中一共展示了SchematicTestRunner.runSchematicAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

  it('should not fail when AppModule have imported RouterModule already', async () => {
    const updateRecorder = appTree.beginUpdate('/projects/bar/src/app/app.module.ts');
    updateRecorder.insertLeft(0, 'import { RouterModule } from \'@angular/router\';');
    appTree.commitUpdate(updateRecorder);

    const tree = await schematicRunner.runSchematicAsync('appShell', defaultOptions, appTree)
      .toPromise();
    const filePath = '/projects/bar/src/app/app.module.ts';
    const content = tree.readContent(filePath);
    expect(content).toMatch(/import { RouterModule } from \'@angular\/router\';/);
  });
开发者ID:angular,项目名称:angular-cli,代码行数:11,代码来源:index_spec.ts

示例2: it

 it('should create icon files', (done) => {
   const dimensions = [72, 96, 128, 144, 152, 192, 384, 512];
   const iconPath = '/projects/bar/src/assets/icons/icon-';
   schematicRunner.runSchematicAsync('ng-add', defaultOptions, appTree).toPromise().then(tree => {
     dimensions.forEach(d => {
       const path = `${iconPath}${d}x${d}.png`;
       expect(tree.exists(path)).toEqual(true);
     });
     done();
   }, done.fail);
 });
开发者ID:angular,项目名称:angular-cli,代码行数:11,代码来源:index_spec.ts

示例3: it

  it('should work as expected for a project with a root', async () => {
    const originalContent = JSON.parse(tree.readContent('angular.json'));
    originalContent.projects['migration-test'].root = 'src';
    tree.overwrite('angular.json', JSON.stringify(originalContent));
    const polyfillPath = '/src/polyfills.ts';
    tree.overwrite(polyfillPath, oldPolyfills);
    const tree2 = await schematicRunner.runSchematicAsync('migration-03', {}, tree.branch())
      .toPromise();

    expect(tree2.readContent(polyfillPath)).not.toMatch(/import .*es7.*reflect.*;/);
  });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:11,代码来源:polyfill-metadata_spec.ts

示例4: it

    it('should not add a theme file multiple times', async () => {
      writeStyleFileToWorkspace(appTree, defaultPrebuiltThemePath);

      const tree = await runner.runSchematicAsync('ng-add-setup-project', {}, appTree).toPromise();
      const workspace = getWorkspace(tree);
      const project = getProjectFromWorkspace(workspace);
      const styles = getProjectTargetOptions(project, 'build').styles;

      expect(styles).toEqual(['projects/material/src/styles.css', defaultPrebuiltThemePath],
          'Expected the "styles.css" file and default prebuilt theme to be the only styles');
    });
开发者ID:codef0rmer,项目名称:material2,代码行数:11,代码来源:index.spec.ts


注:本文中的@angular-devkit/schematics/testing.SchematicTestRunner.runSchematicAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。