feat(di): rename Binding into Provider

Closes #4416

Closes #4654
This commit is contained in:
vsavkin
2015-10-10 22:11:13 -07:00
committed by Victor Savkin
parent 7c6130c2c5
commit 1eb0162cde
190 changed files with 2071 additions and 1816 deletions
@@ -37,11 +37,11 @@ import {
} from 'angular2/src/core/compiler/change_definition_factory';
import {TestDirective, TestDispatcher, TestPipes} from './change_detector_mocks';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
export function main() {
describe('ChangeDefinitionFactory', () => {
beforeEachBindings(() => TEST_BINDINGS);
beforeEachBindings(() => TEST_PROVIDERS);
var parser: TemplateParser;
var dispatcher: TestDispatcher;
@@ -12,7 +12,7 @@ import {
inject,
beforeEachBindings
} from 'angular2/test_lib';
import {bind} from 'angular2/src/core/di';
import {provide} from 'angular2/src/core/di';
import {CONST_EXPR, stringify} from 'angular2/src/core/facade/lang';
import {MapWrapper} from 'angular2/src/core/facade/collection';
@@ -45,7 +45,7 @@ import {
import {evalModule} from './eval_module';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
import {TestDispatcher, TestPipes} from './change_detector_mocks';
import {
codeGenValueFn,
@@ -60,7 +60,7 @@ var THIS_MODULE_REF = moduleRef(THIS_MODULE_URL);
export function main() {
describe('ChangeDetectorCompiler', () => {
beforeEachBindings(() => TEST_BINDINGS);
beforeEachBindings(() => TEST_PROVIDERS);
var parser: TemplateParser;
var compiler: ChangeDetectionCompiler;
@@ -83,8 +83,8 @@ export function main() {
describe('no jit', () => {
beforeEachBindings(() => [
bind(ChangeDetectorGenConfig)
.toValue(new ChangeDetectorGenConfig(true, true, false, false))
provide(ChangeDetectorGenConfig,
{asValue: new ChangeDetectorGenConfig(true, true, false, false)})
]);
it('should watch element properties', () => {
expect(detectChanges(compiler, '<div [el-prop]="someProp">'))
@@ -94,8 +94,8 @@ export function main() {
describe('jit', () => {
beforeEachBindings(() => [
bind(ChangeDetectorGenConfig)
.toValue(new ChangeDetectorGenConfig(true, true, false, true))
provide(ChangeDetectorGenConfig,
{asValue: new ChangeDetectorGenConfig(true, true, false, true)})
]);
it('should watch element properties', () => {
expect(detectChanges(compiler, '<div [el-prop]="someProp">'))
@@ -43,7 +43,7 @@ import {
codeGenExportVariable,
MODULE_SUFFIX
} from 'angular2/src/core/compiler/util';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
const BEGIN_ELEMENT = 'BEGIN_ELEMENT';
const END_ELEMENT = 'END_ELEMENT';
@@ -78,7 +78,7 @@ var NESTED_COMPONENT = new CompiledTemplate(45, () => []);
export function main() {
describe('CommandCompiler', () => {
beforeEachBindings(() => TEST_BINDINGS);
beforeEachBindings(() => TEST_PROVIDERS);
var parser: TemplateParser;
var commandCompiler: CommandCompiler;
@@ -13,7 +13,7 @@ import {
beforeEachBindings
} from 'angular2/test_lib';
import {Component, View, bind} from 'angular2/core';
import {Component, View, provide} from 'angular2/core';
import {PromiseWrapper} from 'angular2/src/core/facade/async';
import {SpyProtoViewFactory} from '../spies';
import {
@@ -39,7 +39,7 @@ export function main() {
protoViewFactorySpy = new SpyProtoViewFactory();
someProtoView = new AppProtoView(null, null, null, null, null, null);
protoViewFactorySpy.spy('createHost').andReturn(someProtoView);
return [bind(ProtoViewFactory).toValue(protoViewFactorySpy)];
return [provide(ProtoViewFactory, {asValue: protoViewFactorySpy})];
});
it('should compile the template via TemplateCompiler',
@@ -33,12 +33,12 @@ import {
SimpleChange
} from 'angular2/core';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
import {MODULE_SUFFIX, IS_DART} from 'angular2/src/core/compiler/util';
export function main() {
describe('RuntimeMetadataResolver', () => {
beforeEachBindings(() => TEST_BINDINGS);
beforeEachBindings(() => TEST_PROVIDERS);
describe('getMetadata', () => {
it('should read metadata',
@@ -12,7 +12,7 @@ import {
inject,
beforeEachBindings
} from 'angular2/test_lib';
import {bind} from 'angular2/src/core/di';
import {provide} from 'angular2/src/core/di';
import {SpyXHR} from '../spies';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
@@ -28,7 +28,7 @@ import {
} from 'angular2/src/core/compiler/directive_metadata';
import {SourceExpression, SourceModule} from 'angular2/src/core/compiler/source_module';
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
import {
codeGenValueFn,
codeGenExportVariable,
@@ -51,7 +51,7 @@ export function main() {
beforeEachBindings(() => {
xhr = <any>new SpyXHR();
return [TEST_BINDINGS, bind(XHR).toValue(xhr)];
return [TEST_PROVIDERS, provide(XHR, {asValue: xhr})];
});
var compiler: StyleCompiler;
@@ -42,9 +42,9 @@ import {
CompiledTemplate
} from 'angular2/src/core/linker/template_commands';
import {Component, View, Directive, bind} from 'angular2/core';
import {Component, View, Directive, provide} from 'angular2/core';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
import {TestDispatcher, TestPipes} from './change_detector_mocks';
import {
codeGenValueFn,
@@ -64,7 +64,7 @@ export function main() {
var compiler: TemplateCompiler;
var runtimeMetadataResolver: RuntimeMetadataResolver;
beforeEachBindings(() => [bind(APP_ID).toValue(APP_ID_VALUE), TEST_BINDINGS]);
beforeEachBindings(() => [provide(APP_ID, {asValue: APP_ID_VALUE}), TEST_PROVIDERS]);
beforeEach(inject([TemplateCompiler, RuntimeMetadataResolver],
(_compiler, _runtimeMetadataResolver) => {
compiler = _compiler;
@@ -22,13 +22,13 @@ import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
import {TemplateNormalizer} from 'angular2/src/core/compiler/template_normalizer';
import {XHR} from 'angular2/src/core/compiler/xhr';
import {MockXHR} from 'angular2/src/core/compiler/xhr_mock';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
export function main() {
describe('TemplateNormalizer', () => {
var dirType: CompileTypeMetadata;
beforeEachBindings(() => TEST_BINDINGS);
beforeEachBindings(() => TEST_PROVIDERS);
beforeEach(() => {
dirType = new CompileTypeMetadata({moduleUrl: 'package:some/module/a.js', name: 'SomeComp'});
@@ -10,9 +10,9 @@ import {
inject,
beforeEachBindings
} from 'angular2/test_lib';
import {bind} from 'angular2/src/core/di';
import {provide} from 'angular2/src/core/di';
import {TEST_BINDINGS} from './test_bindings';
import {TEST_PROVIDERS} from './test_bindings';
import {isPresent} from 'angular2/src/core/facade/lang';
import {TemplateParser, splitClasses} from 'angular2/src/core/compiler/template_parser';
import {
@@ -48,9 +48,12 @@ var expressionUnparser = new Unparser();
export function main() {
describe('TemplateParser', () => {
beforeEachBindings(() => [
TEST_BINDINGS,
bind(ElementSchemaRegistry)
.toValue(new MockSchemaRegistry({'invalidProp': false}, {'mappedAttr': 'mappedProp'}))
TEST_PROVIDERS,
provide(ElementSchemaRegistry,
{
asValue: new MockSchemaRegistry({'invalidProp': false},
{'mappedAttr': 'mappedProp'})
})
]);
var parser: TemplateParser;
@@ -1,5 +1,6 @@
import {bind, Binding} from 'angular2/src/core/di';
import {provide, Provider} from 'angular2/src/core/di';
import {MockSchemaRegistry} from './schema_registry_mock';
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
export var TEST_BINDINGS = [bind(ElementSchemaRegistry).toValue(new MockSchemaRegistry({}, {}))];
export var TEST_PROVIDERS =
[provide(ElementSchemaRegistry, {asValue: new MockSchemaRegistry({}, {})})];