當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。