Skip to content

Commit 96ae348

Browse files
alexeagletbosch
authored andcommitted
chore(build): fix formatting and tests
Closes angular#8098
1 parent 78946fe commit 96ae348

File tree

9 files changed

+20
-24
lines changed

9 files changed

+20
-24
lines changed

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ function runTsc(project, done) {
483483
}
484484

485485
gulp.task('test.js', function(done) {
486-
runSequence('test.unit.tools/ci', 'test.transpiler.unittest', 'test.unit.js/ci',
487-
'test.unit.cjs/ci', 'test.compiler_cli', 'test.typings', 'check-public-api',
486+
runSequence('test.compiler_cli', 'test.unit.tools/ci', 'test.transpiler.unittest',
487+
'test.unit.js/ci', 'test.unit.cjs/ci', 'test.typings', 'check-public-api',
488488
sequenceComplete(done));
489489
});
490490

modules/angular2/src/common/forms/directives/radio_control_value_accessor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {NgControl} from 'angular2/src/common/forms/directives/ng_control';
2020
import {CONST_EXPR, looseIdentical, isPresent} from 'angular2/src/facade/lang';
2121
import {ListWrapper} from 'angular2/src/facade/collection';
2222

23-
export const RADIO_VALUE_ACCESSOR = CONST_EXPR(new Provider(
23+
export const RADIO_VALUE_ACCESSOR = CONST_EXPR(new Provider(
2424
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => RadioControlValueAccessor), multi: true}));
2525

2626

modules/angular2/src/compiler/static_reflector.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface StaticReflectorHost {
7070
*
7171
* This token is unique for a moduleId and name and can be used as a hash table key.
7272
*/
73-
export class StaticSymbol {
73+
export class StaticSymbol implements ModuleContext {
7474
constructor(public moduleId: string, public filePath: string, public name: string) {}
7575
}
7676

@@ -336,7 +336,7 @@ export class StaticReflector implements ReflectorReader {
336336
if (isClassMetadata(declarationValue)) {
337337
result = staticSymbol;
338338
} else {
339-
const newModuleContext =
339+
let newModuleContext =
340340
new ModuleContext(staticSymbol.moduleId, staticSymbol.filePath);
341341
result = _this.simplify(newModuleContext, declarationValue, crossModules);
342342
}
@@ -382,9 +382,6 @@ export class StaticReflector implements ReflectorReader {
382382
}
383383

384384
private getTypeMetadata(type: StaticSymbol): {[key: string]: any} {
385-
if (!(type instanceof StaticSymbol)) {
386-
throw new Error('not static type');
387-
}
388385
let moduleMetadata = this.getModuleMetadata(type.filePath);
389386
let result = moduleMetadata['metadata'][type.name];
390387
if (!isPresent(result)) {

modules/angular2/test/compiler/static_reflector_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ export function main() {
234234
});
235235

236236
it('should simplify a module reference across modules', () => {
237-
expect(crossModuleSimplify({moduleId: '', filePath: '/src/cases'},
237+
expect(crossModuleSimplify(new ModuleContext('', '/src/cases'),
238238
({__symbolic: "reference", module: "./extern", name: "s"})))
239239
.toEqual("s");
240240
});
241241

242242
it('should simplify a module reference without crossing modules', () => {
243-
expect(singleModuleSimplify({moduleId: '', filePath: '/src/cases'},
243+
expect(singleModuleSimplify(new ModuleContext('', '/src/cases'),
244244
({__symbolic: "reference", module: "./extern", name: "s"})))
245245
.toEqual(host.getStaticSymbol('', '/src/extern.d.ts', 's'));
246246
});
@@ -261,7 +261,7 @@ class MockReflectorHost implements StaticReflectorHost {
261261
}
262262

263263
// In tests, assume that symbols are not re-exported
264-
findDeclaration(modulePath: string, symbolName: string, containingFile: string): StaticSymbol {
264+
findDeclaration(modulePath: string, symbolName: string, containingFile?: string): StaticSymbol {
265265
function splitPath(path: string): string[] { return path.split(/\/|\\/g); }
266266

267267
function resolvePath(pathParts: string[]): string {
@@ -294,7 +294,7 @@ class MockReflectorHost implements StaticReflectorHost {
294294

295295
if (modulePath.indexOf('.') === 0) {
296296
return this.getStaticSymbol(`mod/${symbolName}`, pathTo(containingFile, modulePath) + '.d.ts',
297-
symbolName);
297+
symbolName);
298298
}
299299
return this.getStaticSymbol(`mod/${symbolName}`, '/tmp/' + modulePath + '.d.ts', symbolName);
300300
}

modules/playground/src/hello_world/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export function main() {
1414

1515
// A service available to the Injector, used by the HelloCmp component.
1616
@Injectable()
17-
class GreetingService {
17+
export class GreetingService {
1818
greeting: string = 'hello';
1919
}
2020

2121
// Directives are light-weight. They don't allow new
2222
// expression contexts (use @Component for those needs).
2323
@Directive({selector: '[red]'})
24-
class RedDec {
24+
export class RedDec {
2525
// ElementRef is always injectable and it wraps the element on which the
2626
// directive was found by the compiler.
2727
constructor(el: ElementRef, renderer: Renderer) {
@@ -34,8 +34,6 @@ class RedDec {
3434
// ShadowDom.(http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/)
3535
// - Directive - add behavior to existing elements.
3636

37-
// @Component is AtScript syntax to annotate the HelloCmp class as an Angular
38-
// 2.0 component.
3937
@Component({
4038
// The Selector prop tells Angular on which elements to instantiate this
4139
// class. The syntax supported is a basic subset of CSS selectors, for example

modules/playground/src/web_workers/kitchen_sink/index_common.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ class RedDec {
2424
// ShadowDom.(http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/)
2525
// - Directive - add behavior to existing elements.
2626

27-
// @Component is AtScript syntax to annotate the HelloCmp class as an Angular
28-
// 2.0 component.
2927
@Component({
3028
// The Selector prop tells Angular on which elements to instantiate this
3129
// class. The syntax supported is a basic subset of CSS selectors, for example

tools/compiler_cli/src/reflector_host.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export class NodeReflectorHost implements StaticReflectorHost {
6868
if (!symbol) {
6969
throw new Error(`can't find symbol ${symbolName} exported from module ${filePath}`);
7070
}
71-
while (symbol &&
72-
symbol.flags & ts.SymbolFlags.Alias) { // This is an alias, follow what it aliases
71+
if (symbol &&
72+
symbol.flags & ts.SymbolFlags.Alias) { // This is an alias, follow what it aliases
7373
symbol = tc.getAliasedSymbol(symbol);
7474
}
7575
const declaration = symbol.getDeclarations()[0];

tools/metadata/test/evaluator.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,20 @@ describe('Evaluator', () => {
117117
expect(evaluator.evaluateNode(findVar(forwardRef, 'bFalse').initializer)).toEqual(false);
118118
});
119119

120-
it('should return new expressions', () => {
120+
fit('should return new expressions', () => {
121+
evaluator =
122+
new Evaluator(typeChecker, symbols, [{from: './classes', namedImports: [{name: 'Value'}]}]);
121123
var newExpression = program.getSourceFile('newExpression.ts');
122124
expect(evaluator.evaluateNode(findVar(newExpression, 'someValue').initializer))
123125
.toEqual({
124126
__symbolic: "new",
125-
expression: {__symbolic: "reference", name: "Value", module: "classes.ts"},
127+
expression: {__symbolic: "reference", name: "Value", module: "./classes"},
126128
arguments: ["name", 12]
127129
});
128130
expect(evaluator.evaluateNode(findVar(newExpression, 'complex').initializer))
129131
.toEqual({
130132
__symbolic: "new",
131-
expression: {__symbolic: "reference", name: "Value", module: "classes.ts"},
133+
expression: {__symbolic: "reference", name: "Value", module: "./classes"},
132134
arguments: ["name", 12]
133135
});
134136
});

tools/public_api_guard/public_api_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ const COMPILER = [
10311031
'CompileDirectiveMetadata.type:CompileTypeMetadata',
10321032
'CompileDirectiveMetadata.viewQueries:CompileQueryMetadata[]',
10331033
'CompileTemplateMetadata',
1034-
'CompileTemplateMetadata.constructor({encapsulation,template,templateUrl,styles,styleUrls,ngContentSelectors}:{encapsulation?:ViewEncapsulation, template?:string, templateUrl?:string, styles?:string[], styleUrls?:string[], ngContentSelectors?:string[]})',
1034+
'CompileTemplateMetadata.constructor({encapsulation,template,templateUrl,styles,styleUrls,ngContentSelectors,baseUrl}:{encapsulation?:ViewEncapsulation, template?:string, templateUrl?:string, styles?:string[], styleUrls?:string[], ngContentSelectors?:string[], baseUrl?:string})',
10351035
'CompileTemplateMetadata.encapsulation:ViewEncapsulation',
10361036
'CompileTemplateMetadata.fromJson(data:{[key:string]:any}):CompileTemplateMetadata',
10371037
'CompileTemplateMetadata.ngContentSelectors:string[]',
@@ -1040,6 +1040,7 @@ const COMPILER = [
10401040
'CompileTemplateMetadata.template:string',
10411041
'CompileTemplateMetadata.templateUrl:string',
10421042
'CompileTemplateMetadata.toJson():{[key:string]:any}',
1043+
'CompileTemplateMetadata.baseUrl:string',
10431044
'CompileTypeMetadata',
10441045
'CompileTypeMetadata.diDeps:CompileDiDependencyMetadata[]',
10451046
'CompileTypeMetadata.fromJson(data:{[key:string]:any}):CompileTypeMetadata',

0 commit comments

Comments
 (0)