refactor: IS_DART === false
This commit is contained in:
@ -13,7 +13,7 @@ import {TestBed} from '@angular/core/testing';
|
||||
import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {CompileNgModuleMetadata} from '../src/compile_metadata';
|
||||
import {IS_DART, stringify} from '../src/facade/lang';
|
||||
import {stringify} from '../src/facade/lang';
|
||||
import {CompileMetadataResolver} from '../src/metadata_resolver';
|
||||
|
||||
import {MalformedStylesComponent} from './metadata_resolver_fixture';
|
||||
@ -49,10 +49,9 @@ export function main() {
|
||||
|
||||
it('should use the moduleUrl from the reflector if none is given',
|
||||
inject([CompileMetadataResolver], (resolver: CompileMetadataResolver) => {
|
||||
var value: string =
|
||||
const value: string =
|
||||
resolver.getDirectiveMetadata(ComponentWithoutModuleId).type.moduleUrl;
|
||||
var expectedEndValue =
|
||||
IS_DART ? 'test/compiler/metadata_resolver_spec.dart' : './ComponentWithoutModuleId';
|
||||
const expectedEndValue = './ComponentWithoutModuleId';
|
||||
expect(value.endsWith(expectedEndValue)).toBe(true);
|
||||
}));
|
||||
|
||||
|
@ -13,7 +13,7 @@ import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {IS_DART, print} from '../../src/facade/lang';
|
||||
import {print} from '../../src/facade/lang';
|
||||
import {assetUrl} from '../../src/util';
|
||||
|
||||
import {SimpleJsImportGenerator, codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
@ -24,16 +24,14 @@ export function getExpressions(): any {
|
||||
|
||||
// Generator
|
||||
export function emit() {
|
||||
var emitter = IS_DART ? new DartEmitter(new DartImportGenerator()) :
|
||||
new TypeScriptEmitter(new SimpleJsImportGenerator());
|
||||
var emittedCode = emitter.emitStatements(
|
||||
const emitter = new TypeScriptEmitter(new SimpleJsImportGenerator());
|
||||
const emittedCode = emitter.emitStatements(
|
||||
assetUrl('compiler', 'output/output_emitter_codegen_typed', 'test'), codegenStmts,
|
||||
codegenExportsVars);
|
||||
return emittedCode;
|
||||
}
|
||||
|
||||
export function main(args: string[]) {
|
||||
var emittedCode = emit();
|
||||
// debug: console.error(emittedCode);
|
||||
const emittedCode = emit();
|
||||
print(emittedCode);
|
||||
}
|
||||
|
@ -9,8 +9,6 @@
|
||||
import {UrlResolver, createOfflineCompileUrlResolver} from '@angular/compiler/src/url_resolver';
|
||||
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {IS_DART} from '../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe('UrlResolver', () => {
|
||||
var resolver = new UrlResolver();
|
||||
@ -96,18 +94,9 @@ export function main() {
|
||||
expect(resolver.resolve(null, 'some/dir/file.txt')).toEqual('some/dir/file.txt');
|
||||
});
|
||||
|
||||
it('should contain a default value of "/packages" when nothing is provided for DART',
|
||||
it('should contain a default value of "/" when nothing is provided',
|
||||
inject([UrlResolver], (resolver: UrlResolver) => {
|
||||
if (IS_DART) {
|
||||
expect(resolver.resolve(null, 'package:file')).toEqual('/packages/file');
|
||||
}
|
||||
}));
|
||||
|
||||
it('should contain a default value of "/" when nothing is provided for TS/ESM',
|
||||
inject([UrlResolver], (resolver: UrlResolver) => {
|
||||
if (!IS_DART) {
|
||||
expect(resolver.resolve(null, 'package:file')).toEqual('/file');
|
||||
}
|
||||
expect(resolver.resolve(null, 'package:file')).toEqual('/file');
|
||||
}));
|
||||
|
||||
it('should resolve a package value when present within the baseurl', () => {
|
||||
|
Reference in New Issue
Block a user