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


TypeScript UnitTestTree.delete方法代码示例

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


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

示例1: makeInlineTemplate

    function makeInlineTemplate(tree: UnitTestTree, template?: string): void {
      template = template || `
      <p>
        App works!
      </p>`;
      const newText = `
        import { Component, OnInit } from '@angular/core';

        @Component({
          selector: ''
          template: \`
            ${template}
          \`,
          styleUrls: ['./app.component.css']
        })
        export class AppComponent implements OnInit {

          constructor() { }

          ngOnInit() {
          }

        }

      `;
      tree.overwrite('/projects/bar/src/app/app.component.ts', newText);
      tree.delete('/projects/bar/src/app/app.component.html');
    }
开发者ID:baconwaffles,项目名称:angular-cli,代码行数:28,代码来源:index_spec.ts

示例2: it

 it(`should create browserslist file if it doesn't exist`, () => {
   tree.delete('/browserslist');
   const tree2 = schematicRunner.runSchematic('migration-07', {}, tree.branch());
   expect(tree2.exists('/browserslist')).toBe(true);
   expect(tree2.readContent('/browserslist'))
     .toContain('Support for Googlebot');
 });
开发者ID:angular,项目名称:angular-cli,代码行数:7,代码来源:differential-loading_spec.ts

示例3: it

 it('should add production configuration when no production environment', () => {
   tree.delete('/src/environments/environment.prod.ts');
   tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
   tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
   const config = getConfig(tree);
   expect(config.projects.foo.targets.build.configurations).toEqual({
     prod: {
       fileReplacements: [{
         replace: 'src/environments/environment.ts',
         with: 'src/environments/environment.prod.ts',
       }],
     },
     production: {
       optimization: true,
       outputHashing: 'all',
       sourceMap: false,
       extractCss: true,
       namedChunks: false,
       aot: true,
       extractLicenses: true,
       vendorChunk: false,
       buildOptimizer: true,
     },
   });
 });
开发者ID:rexebin,项目名称:angular-cli,代码行数:25,代码来源:index_spec.ts

示例4: it

  it('should properly add css reset', () => {
    tree.create('src/styles.scss', '');
    runner.runSchematic('ng-add', { normalizeCss: true }, tree);
    let pkgJsonData = JSON.parse(tree.readContent('/package.json'));
    expect(tree.readContent('src/styles.scss')).toEqual(scssImport);
    expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
    resetJsonConfigs(tree);
    tree.delete('src/styles.scss');

    tree.create('src/styles.sass', '');
    runner.runSchematic('ng-add', { normalizeCss: true }, tree);
    pkgJsonData = JSON.parse(tree.readContent('/package.json'));
    expect(tree.readContent('src/styles.sass')).toEqual(scssImport);
    expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
    resetJsonConfigs(tree);
    tree.delete('src/styles.sass');

    tree.create('src/styles.css', '');
    runner.runSchematic('ng-add', { normalizeCss: true }, tree);
    pkgJsonData = JSON.parse(tree.readContent('/package.json'));
    expect(tree.readContent('src/styles.css')).toBe('');
    expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
    expect(JSON.parse(tree.readContent('/angular.json')).projects['testProj'].architect.build.options.styles).toContain(cssImport);
    resetJsonConfigs(tree);
    tree.delete('src/styles.css');

    tree.create('src/styles.less', '');
    runner.runSchematic('ng-add', { normalizeCss: true }, tree);
    pkgJsonData = JSON.parse(tree.readContent('/package.json'));
    expect(tree.readContent('src/styles.less')).toBe('');
    expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
    expect(JSON.parse(tree.readContent('/angular.json')).projects['testProj'].architect.build.options.styles).toContain(cssImport);
    resetJsonConfigs(tree);
    tree.delete('src/styles.less');

    tree.create('src/styles.styl', '');
    runner.runSchematic('ng-add', { normalizeCss: true }, tree);
    pkgJsonData = JSON.parse(tree.readContent('/package.json'));
    expect(tree.readContent('src/styles.styl')).toBe('');
    expect(pkgJsonData.dependencies['minireset.css']).toBeTruthy();
    expect(JSON.parse(tree.readContent('/angular.json')).projects['testProj'].architect.build.options.styles).toContain(cssImport);
    resetJsonConfigs(tree);
    tree.delete('src/styles.styl');
  });
开发者ID:IgniteUI,项目名称:igniteui-angular,代码行数:44,代码来源:index.spec.ts

示例5: runTest

  function runTest(testFn: Function, obj: JsonValue, indent: number): string {
    const content = JSON.stringify(obj, null, indent);
    tree.create(filePath, content);
    const ast = parseJsonAst(content);
    const rec = tree.beginUpdate(filePath);
    testFn(rec, ast);
    tree.commitUpdate(rec);

    const result = tree.readContent(filePath);
    // Clean up the tree by deleting the file.
    tree.delete(filePath);

    return result;
  }
开发者ID:angular,项目名称:angular-cli,代码行数:14,代码来源:json-utils_spec.ts

示例6: runTest

    function runTest(obj: Pojso, prop: string, val: string): Pojso {
      const content = JSON.stringify(obj, null, 2);
      tree.create(filePath, content);
      const ast = parseJsonAst(content);
      const rec = tree.beginUpdate(filePath);
      if (ast.kind === 'object') {
        insertPropertyInAstObjectInOrder(rec, ast, prop, val, 2);
      }
      tree.commitUpdate(rec);

      const result = JSON.parse(tree.readContent(filePath));
      // Clean up the tree by deleting the file.
      tree.delete(filePath);

      return result;
    }
开发者ID:DevIntent,项目名称:angular-cli,代码行数:16,代码来源:json-utils_spec.ts

示例7: it

 it('throws if angular.json is not found', () => {
   expect(host.files).toContain('/angular.json');
   host.delete('/angular.json');
   expect(() => schematicRunner.runSchematic('ng-add', defaultOptions, host))
       .toThrowError('Could not find angular.json');
 });
开发者ID:Cammisuli,项目名称:angular,代码行数:6,代码来源:index_spec.ts


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