refactor: rename all const to UPPER_CASE
Closes #3573 BREAKING CHANGE Rename: - `appComponentTypeToken` => `APP_COMPONENT` - `coreDirectives` => `CORE_DIRECTIVES` - `formDirectives` => `FORM_DIRECTIVES` - `formInjectables` => `FORM_BINDINGS` - `httpInjectables` => `HTTP_BINDINGS` - `jsonpInjectables` => `JSONP_BINDINGS` - `PROTO_CHANGE_DETECTOR_KEY` => `PROTO_CHANGE_DETECTOR` - `appComponentRefPromiseToken` => `APP_COMPONENT_REF_PROMISE` - `appComponentTypeToken` => `APP_COMPONENT` - `undefinedValue` => `UNDEFINED` - `formDirectives` => `FORM_DIRECTIVES` - `DOCUMENT_TOKEN` => `DOCUMENT` - `APP_ID_TOKEN` => `APP_ID` - `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN` => `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE` - `appBaseHrefToken` => `APP_BASE_HREF`
This commit is contained in:
@@ -20,7 +20,7 @@ import {bind, Inject, Injector} from 'angular2/di';
|
||||
import {LifeCycle} from 'angular2/core';
|
||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
|
||||
@Component({selector: 'hello-app'})
|
||||
@View({template: '{{greeting}} world!'})
|
||||
@@ -87,7 +87,7 @@ export function main() {
|
||||
DOM.appendChild(fakeDoc.body, el2);
|
||||
DOM.appendChild(el, lightDom);
|
||||
DOM.setText(lightDom, 'loading');
|
||||
testBindings = [bind(DOCUMENT_TOKEN).toValue(fakeDoc)];
|
||||
testBindings = [bind(DOCUMENT).toValue(fakeDoc)];
|
||||
});
|
||||
|
||||
it('should throw if bootstrapped Directive is not a Component',
|
||||
|
||||
@@ -24,7 +24,7 @@ import {Component, View, LifecycleEvent} from 'angular2/annotations';
|
||||
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
|
||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
export function main() {
|
||||
@@ -218,7 +218,7 @@ export function main() {
|
||||
|
||||
describe('loadAsRoot', () => {
|
||||
it('should allow to create, update and destroy components',
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT_TOKEN, Injector],
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async, loader, doc, injector) => {
|
||||
var rootEl = el('<child-cmp></child-cmp>');
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
ViewEncapsulation
|
||||
} from 'angular2/angular2';
|
||||
|
||||
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN} from 'angular2/src/render/render';
|
||||
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE} from 'angular2/src/render/render';
|
||||
|
||||
export function main() {
|
||||
describe('projection', () => {
|
||||
@@ -445,12 +445,12 @@ export function main() {
|
||||
}
|
||||
|
||||
describe('serialize templates', () => {
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(0)]);
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(0)]);
|
||||
runTests();
|
||||
});
|
||||
|
||||
describe("don't serialize templates", () => {
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(-1)]);
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(-1)]);
|
||||
runTests();
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
Control,
|
||||
ControlGroup,
|
||||
NgForm,
|
||||
formDirectives,
|
||||
FORM_DIRECTIVES,
|
||||
Validators,
|
||||
NgControl,
|
||||
ControlValueAccessor
|
||||
@@ -770,7 +770,7 @@ class WrappedValue implements ControlValueAccessor {
|
||||
}
|
||||
|
||||
@Component({selector: "my-comp"})
|
||||
@View({directives: [formDirectives, WrappedValue, NgIf, NgFor]})
|
||||
@View({directives: [FORM_DIRECTIVES, WrappedValue, NgIf, NgFor]})
|
||||
class MyComp {
|
||||
form: any;
|
||||
name: string;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {DomRenderer} from 'angular2/src/render/dom/dom_renderer';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/dom/dom_tokens';
|
||||
import {DOCUMENT} from 'angular2/src/render/dom/dom_tokens';
|
||||
import {DefaultDomCompiler} from 'angular2/src/render/dom/compiler/compiler';
|
||||
import {
|
||||
RenderViewWithFragments,
|
||||
@@ -65,8 +65,7 @@ export class DomTestbed {
|
||||
compiler: DefaultDomCompiler;
|
||||
rootEl;
|
||||
|
||||
constructor(renderer: DomRenderer, compiler: DefaultDomCompiler,
|
||||
@Inject(DOCUMENT_TOKEN) document) {
|
||||
constructor(renderer: DomRenderer, compiler: DefaultDomCompiler, @Inject(DOCUMENT) document) {
|
||||
this.renderer = renderer;
|
||||
this.compiler = compiler;
|
||||
this.rootEl = el('<div id="root" class="rootElem"></div>');
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
|
||||
import {Injector, bind} from 'angular2/di';
|
||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {Location, appBaseHrefToken} from 'angular2/src/router/location';
|
||||
import {Location, APP_BASE_HREF} from 'angular2/src/router/location';
|
||||
import {LocationStrategy} from 'angular2/src/router/location_strategy';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
|
||||
@@ -71,7 +71,7 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should use optional base href param', () => {
|
||||
let location = makeLocation('/', bind(appBaseHrefToken).toValue('/my/custom/href'));
|
||||
let location = makeLocation('/', bind(APP_BASE_HREF).toValue('/my/custom/href'));
|
||||
location.go('user/btford');
|
||||
expect(locationStrategy.path()).toEqual('/my/custom/href/user/btford');
|
||||
});
|
||||
|
||||
@@ -15,14 +15,14 @@ import {bootstrap} from 'angular2/bootstrap';
|
||||
import {Component, Directive, View} from 'angular2/annotations';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {bind} from 'angular2/di';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
|
||||
import {
|
||||
routerInjectables,
|
||||
Router,
|
||||
RouteConfig,
|
||||
appBaseHrefToken,
|
||||
APP_BASE_HREF,
|
||||
routerDirectives
|
||||
} from 'angular2/router';
|
||||
|
||||
@@ -49,7 +49,7 @@ export function main() {
|
||||
testBindings = [
|
||||
routerInjectables,
|
||||
bind(LocationStrategy).toClass(MockLocationStrategy),
|
||||
bind(DOCUMENT_TOKEN).toValue(fakeDoc),
|
||||
bind(DOCUMENT).toValue(fakeDoc),
|
||||
bind(ExceptionHandler).toValue(exceptionHandler)
|
||||
];
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ import {bootstrap} from 'angular2/src/core/application';
|
||||
import {Component, Directive, View} from 'angular2/src/core/annotations/decorators';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {bind} from 'angular2/di';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {RouteConfig, Route, Redirect} from 'angular2/src/router/route_config_decorator';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {BaseException} from 'angular2/src/facade/lang';
|
||||
@@ -26,14 +26,14 @@ import {
|
||||
routerInjectables,
|
||||
RouteParams,
|
||||
Router,
|
||||
appBaseHrefToken,
|
||||
APP_BASE_HREF,
|
||||
routerDirectives,
|
||||
HashLocationStrategy
|
||||
} from 'angular2/router';
|
||||
|
||||
import {LocationStrategy} from 'angular2/src/router/location_strategy';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
import {appComponentTypeToken} from 'angular2/src/core/application_tokens';
|
||||
import {APP_COMPONENT} from 'angular2/src/core/application_tokens';
|
||||
|
||||
export function main() {
|
||||
describe('router injectables', () => {
|
||||
@@ -53,7 +53,7 @@ export function main() {
|
||||
[
|
||||
routerInjectables,
|
||||
bind(LocationStrategy).toClass(MockLocationStrategy),
|
||||
bind(DOCUMENT_TOKEN).toValue(fakeDoc)
|
||||
bind(DOCUMENT).toValue(fakeDoc)
|
||||
])
|
||||
.then((applicationRef) => {
|
||||
var router = applicationRef.hostComponent.router;
|
||||
@@ -67,7 +67,7 @@ export function main() {
|
||||
});
|
||||
|
||||
describe('broken app', () => {
|
||||
beforeEachBindings(() => { return [bind(appComponentTypeToken).toValue(BrokenAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(BrokenAppCmp)]; });
|
||||
|
||||
it('should rethrow exceptions from component constructors',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
@@ -83,7 +83,7 @@ export function main() {
|
||||
});
|
||||
|
||||
describe('back button app', () => {
|
||||
beforeEachBindings(() => { return [bind(appComponentTypeToken).toValue(HierarchyAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(HierarchyAppCmp)]; });
|
||||
|
||||
it('should change the url without pushing a new history state for back navigations',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
@@ -134,7 +134,7 @@ export function main() {
|
||||
});
|
||||
|
||||
describe('hierarchical app', () => {
|
||||
beforeEachBindings(() => { return [bind(appComponentTypeToken).toValue(HierarchyAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(HierarchyAppCmp)]; });
|
||||
|
||||
it('should bootstrap an app with a hierarchy',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
@@ -152,7 +152,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
describe('custom app base ref', () => {
|
||||
beforeEachBindings(() => { return [bind(appBaseHrefToken).toValue('/my/app')]; });
|
||||
beforeEachBindings(() => { return [bind(APP_BASE_HREF).toValue('/my/app')]; });
|
||||
it('should bootstrap', inject([AsyncTestCompleter, TestComponentBuilder],
|
||||
(async, tcb: TestComponentBuilder) => {
|
||||
|
||||
@@ -174,8 +174,7 @@ export function main() {
|
||||
// TODO: add a test in which the child component has bindings
|
||||
|
||||
describe('querystring params app', () => {
|
||||
beforeEachBindings(
|
||||
() => { return [bind(appComponentTypeToken).toValue(QueryStringAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(QueryStringAppCmp)]; });
|
||||
|
||||
it('should recognize and return querystring params with the injected RouteParams',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
|
||||
Reference in New Issue
Block a user