repackaging: all the repackaging changes squashed
This commit is contained in:
@ -1,16 +1,13 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {
|
||||
CompileDirectiveMetadata,
|
||||
@ -22,10 +19,10 @@ import {
|
||||
CompileIdentifierMetadata,
|
||||
CompileFactoryMetadata,
|
||||
CompileTokenMetadata
|
||||
} from 'angular2/src/compiler/compile_metadata';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection';
|
||||
import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks';
|
||||
} from '@angular/compiler/src/compile_metadata';
|
||||
import {ViewEncapsulation} from '@angular/core/src/metadata/view';
|
||||
import {ChangeDetectionStrategy} from '@angular/core/src/change_detection';
|
||||
import {LifecycleHooks} from '@angular/core/src/metadata/lifecycle_hooks';
|
||||
|
||||
export function main() {
|
||||
describe('CompileMetadata', () => {
|
||||
|
@ -7,9 +7,9 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {isPresent} from "angular2/src/facade/lang";
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
|
||||
import {
|
||||
CssToken,
|
||||
@ -17,7 +17,7 @@ import {
|
||||
CssLexer,
|
||||
CssLexerMode,
|
||||
CssTokenType
|
||||
} from 'angular2/src/compiler/css/lexer';
|
||||
} from '@angular/compiler/src/css/lexer';
|
||||
|
||||
export function main() {
|
||||
function tokenize(code, trackComments: boolean = false,
|
||||
|
@ -7,9 +7,9 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
|
||||
import {
|
||||
ParsedCssResult,
|
||||
@ -29,9 +29,9 @@ import {
|
||||
CssRuleAST,
|
||||
CssBlockAST,
|
||||
CssParseError
|
||||
} from 'angular2/src/compiler/css/parser';
|
||||
} from '@angular/compiler/src/css/parser';
|
||||
|
||||
import {CssLexer} from 'angular2/src/compiler/css/lexer';
|
||||
import {CssLexer} from '@angular/compiler/src/css/lexer';
|
||||
|
||||
export function assertTokens(tokens, valuesArr) {
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
|
@ -7,10 +7,10 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {NumberWrapper, StringWrapper, isPresent} from "angular2/src/facade/lang";
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {NumberWrapper, StringWrapper, isPresent} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
|
||||
import {
|
||||
CssToken,
|
||||
@ -33,9 +33,9 @@ import {
|
||||
CssBlockAST,
|
||||
CssASTVisitor,
|
||||
CssUnknownTokenListAST
|
||||
} from 'angular2/src/compiler/css/parser';
|
||||
} from '@angular/compiler/src/css/parser';
|
||||
|
||||
import {CssLexer} from 'angular2/src/compiler/css/lexer';
|
||||
import {CssLexer} from '@angular/compiler/src/css/lexer';
|
||||
|
||||
function _assertTokens(tokens, valuesArr) {
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
|
@ -1,20 +1,16 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
xdescribe,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
SpyObject,
|
||||
proxy
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {hasLifecycleHook} from 'angular2/src/compiler/directive_lifecycle_reflector';
|
||||
import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks';
|
||||
import {hasLifecycleHook} from '@angular/compiler/src/directive_lifecycle_reflector';
|
||||
import {LifecycleHooks} from '@angular/core/src/metadata/lifecycle_hooks';
|
||||
|
||||
export function main() {
|
||||
describe('Create DirectiveMetadata', () => {
|
||||
|
@ -1,24 +1,21 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {CompileTypeMetadata, CompileTemplateMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import {ViewEncapsulation} from '@angular/core/src/metadata/view';
|
||||
|
||||
import {CompileTypeMetadata, CompileTemplateMetadata} from 'angular2/src/compiler/compile_metadata';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||
|
||||
import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {MockXHR} from 'angular2/src/compiler/xhr_mock';
|
||||
import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer';
|
||||
import {XHR} from '@angular/compiler/src/xhr';
|
||||
import {MockXHR} from '@angular/compiler/testing';
|
||||
import {TEST_PROVIDERS} from './test_bindings';
|
||||
|
||||
export function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/testing_internal';
|
||||
import {DirectiveResolver} from 'angular2/src/compiler/directive_resolver';
|
||||
import {ddescribe, describe, it, iit, expect, beforeEach} from '@angular/core/testing';
|
||||
import {DirectiveResolver} from '@angular/compiler/src/directive_resolver';
|
||||
import {
|
||||
DirectiveMetadata,
|
||||
Directive,
|
||||
@ -15,7 +15,7 @@ import {
|
||||
ContentChildMetadata,
|
||||
ViewChild,
|
||||
ViewChildMetadata
|
||||
} from 'angular2/src/core/metadata';
|
||||
} from '@angular/core/src/metadata';
|
||||
|
||||
@Directive({selector: 'someDirective'})
|
||||
class SomeDirective {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {ddescribe, describe, it, expect} from 'angular2/testing_internal';
|
||||
import {ddescribe, describe, it, expect} from '@angular/core/testing';
|
||||
|
||||
import {Lexer, Token} from 'angular2/src/compiler/expression_parser/lexer';
|
||||
import {Lexer, Token} from '@angular/compiler/src/expression_parser/lexer';
|
||||
|
||||
import {StringWrapper} from "angular2/src/facade/lang";
|
||||
import {StringWrapper} from '../../src/facade/lang';
|
||||
|
||||
function lex(text: string): any[] {
|
||||
return new Lexer().tokenize(text);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {ddescribe, describe, it, xit, iit, expect, beforeEach} from 'angular2/testing_internal';
|
||||
import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
import {Parser} from 'angular2/src/compiler/expression_parser/parser';
|
||||
import {ddescribe, describe, it, xit, iit, expect, beforeEach} from '@angular/core/testing';
|
||||
import {isBlank, isPresent} from '../../src/facade/lang';
|
||||
import {Parser} from '@angular/compiler/src/expression_parser/parser';
|
||||
import {Unparser} from './unparser';
|
||||
import {Lexer} from 'angular2/src/compiler/expression_parser/lexer';
|
||||
import {BindingPipe, LiteralPrimitive, AST} from 'angular2/src/compiler/expression_parser/ast';
|
||||
import {Lexer} from '@angular/compiler/src/expression_parser/lexer';
|
||||
import {BindingPipe, LiteralPrimitive, AST} from '@angular/compiler/src/expression_parser/ast';
|
||||
|
||||
export function main() {
|
||||
function createParser() { return new Parser(new Lexer()); }
|
||||
|
@ -21,10 +21,10 @@ import {
|
||||
Quote,
|
||||
SafePropertyRead,
|
||||
SafeMethodCall
|
||||
} from 'angular2/src/compiler/expression_parser/ast';
|
||||
} from '../../src/expression_parser/ast';
|
||||
|
||||
|
||||
import {StringWrapper, isPresent, isString} from 'angular2/src/facade/lang';
|
||||
import {StringWrapper, isPresent, isString} from '../../src/facade/lang';
|
||||
|
||||
export class Unparser implements AstVisitor {
|
||||
private static _quoteRegExp = /"/g;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from 'angular2/src/compiler/html_parser';
|
||||
import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from '@angular/compiler/src/html_parser';
|
||||
import {
|
||||
HtmlAst,
|
||||
HtmlAstVisitor,
|
||||
@ -9,9 +9,9 @@ import {
|
||||
HtmlExpansionAst,
|
||||
HtmlExpansionCaseAst,
|
||||
htmlVisitAll
|
||||
} from 'angular2/src/compiler/html_ast';
|
||||
import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
} from '@angular/compiler/src/html_ast';
|
||||
import {ParseError, ParseLocation} from '@angular/compiler/src/parse_util';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
|
||||
export function humanizeDom(parseResult: HtmlParseTreeResult): any[] {
|
||||
if (parseResult.errors.length > 0) {
|
||||
|
@ -7,16 +7,16 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
|
||||
import {
|
||||
tokenizeHtml,
|
||||
HtmlToken,
|
||||
HtmlTokenType,
|
||||
HtmlTokenError
|
||||
} from 'angular2/src/compiler/html_lexer';
|
||||
import {ParseSourceSpan, ParseLocation, ParseSourceFile} from 'angular2/src/compiler/parse_util';
|
||||
} from '@angular/compiler/src/html_lexer';
|
||||
import {ParseSourceSpan, ParseLocation, ParseSourceFile} from '@angular/compiler/src/parse_util';
|
||||
|
||||
export function main() {
|
||||
describe('HtmlLexer', () => {
|
||||
|
@ -7,10 +7,10 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {HtmlTokenType} from 'angular2/src/compiler/html_lexer';
|
||||
import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from 'angular2/src/compiler/html_parser';
|
||||
import {HtmlTokenType} from '@angular/compiler/src/html_lexer';
|
||||
import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from '@angular/compiler/src/html_parser';
|
||||
import {
|
||||
HtmlAst,
|
||||
HtmlAstVisitor,
|
||||
@ -21,8 +21,8 @@ import {
|
||||
htmlVisitAll,
|
||||
HtmlExpansionAst,
|
||||
HtmlExpansionCaseAst
|
||||
} from 'angular2/src/compiler/html_ast';
|
||||
import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util';
|
||||
} from '@angular/compiler/src/html_ast';
|
||||
import {ParseError, ParseLocation} from '@angular/compiler/src/parse_util';
|
||||
import {humanizeDom, humanizeDomSourceSpans, humanizeLineColumn} from './html_ast_spec_utils';
|
||||
|
||||
export function main() {
|
||||
@ -389,4 +389,4 @@ export function humanizeErrors(errors: ParseError[]): any[] {
|
||||
// Tokenizer errors
|
||||
return [(<any>error).tokenType, error.msg, humanizeLineColumn(error.span.start)];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@ -9,15 +8,15 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {I18nHtmlParser} from 'angular2/src/i18n/i18n_html_parser';
|
||||
import {Message, id} from 'angular2/src/i18n/message';
|
||||
import {Parser} from 'angular2/src/compiler/expression_parser/parser';
|
||||
import {Lexer} from 'angular2/src/compiler/expression_parser/lexer';
|
||||
import {I18nHtmlParser} from '@angular/compiler/src/i18n/i18n_html_parser';
|
||||
import {Message, id} from '@angular/compiler/src/i18n/message';
|
||||
import {Parser} from '@angular/compiler/src/expression_parser/parser';
|
||||
import {Lexer} from '@angular/compiler/src/expression_parser/lexer';
|
||||
|
||||
import {StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {HtmlParser, HtmlParseTreeResult} from 'angular2/src/compiler/html_parser';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {HtmlParser, HtmlParseTreeResult} from '@angular/compiler/src/html_parser';
|
||||
import {
|
||||
HtmlAst,
|
||||
HtmlAstVisitor,
|
||||
@ -26,10 +25,10 @@ import {
|
||||
HtmlTextAst,
|
||||
HtmlCommentAst,
|
||||
htmlVisitAll
|
||||
} from 'angular2/src/compiler/html_ast';
|
||||
import {serializeXmb, deserializeXmb} from 'angular2/src/i18n/xmb_serializer';
|
||||
import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util';
|
||||
import {humanizeDom} from '../../test/compiler/html_ast_spec_utils';
|
||||
} from '@angular/compiler/src/html_ast';
|
||||
import {serializeXmb, deserializeXmb} from '@angular/compiler/src/i18n/xmb_serializer';
|
||||
import {ParseError, ParseLocation} from '@angular/compiler/src/parse_util';
|
||||
import {humanizeDom} from '@angular/compiler/test/html_ast_spec_utils';
|
||||
|
||||
export function main() {
|
||||
describe('I18nHtmlParser', () => {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
describe,
|
||||
ddescribe,
|
||||
@ -9,13 +8,13 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {HtmlParser} from 'angular2/src/compiler/html_parser';
|
||||
import {MessageExtractor, removeDuplicates} from 'angular2/src/i18n/message_extractor';
|
||||
import {Message} from 'angular2/src/i18n/message';
|
||||
import {Parser} from 'angular2/src/compiler/expression_parser/parser';
|
||||
import {Lexer} from 'angular2/src/compiler/expression_parser/lexer';
|
||||
import {HtmlParser} from '@angular/compiler/src/html_parser';
|
||||
import {MessageExtractor, removeDuplicates} from '@angular/compiler/src/i18n/message_extractor';
|
||||
import {Message} from '@angular/compiler/src/i18n/message';
|
||||
import {Parser} from '@angular/compiler/src/expression_parser/parser';
|
||||
import {Lexer} from '@angular/compiler/src/expression_parser/lexer';
|
||||
|
||||
export function main() {
|
||||
describe('MessageExtractor', () => {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@ -9,9 +8,9 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {Message, id} from 'angular2/src/i18n/message';
|
||||
import {Message, id} from '@angular/compiler/src/i18n/message';
|
||||
|
||||
export function main() {
|
||||
describe('Message', () => {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
@ -9,12 +8,12 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {HtmlAst} from 'angular2/src/compiler/html_ast';
|
||||
import {Message, id} from 'angular2/src/i18n/message';
|
||||
import {serializeXmb, deserializeXmb} from 'angular2/src/i18n/xmb_serializer';
|
||||
import {ParseSourceSpan, ParseError} from 'angular2/src/compiler/parse_util';
|
||||
import {HtmlAst} from '@angular/compiler/src/html_ast';
|
||||
import {Message, id} from '@angular/compiler/src/i18n/message';
|
||||
import {serializeXmb, deserializeXmb} from '@angular/compiler/src/i18n/xmb_serializer';
|
||||
import {ParseSourceSpan, ParseError} from '@angular/compiler/src/parse_util';
|
||||
|
||||
export function main() {
|
||||
describe("Xmb", () => {
|
||||
@ -114,4 +113,4 @@ function _serialize(nodes: HtmlAst[]): string {
|
||||
|
||||
function _serializeErrors(errors: ParseError[]): string[] {
|
||||
return errors.map(e => e.msg);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
import {
|
||||
TestComponentBuilder,
|
||||
AsyncTestCompleter,
|
||||
ddescribe,
|
||||
describe,
|
||||
it,
|
||||
@ -11,7 +9,7 @@ import {
|
||||
afterEach,
|
||||
beforeEachProviders,
|
||||
inject
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {
|
||||
HtmlAst,
|
||||
@ -20,9 +18,9 @@ import {
|
||||
HtmlAttrAst,
|
||||
HtmlTextAst,
|
||||
htmlVisitAll
|
||||
} from 'angular2/src/compiler/html_ast';
|
||||
} from '@angular/compiler/src/html_ast';
|
||||
|
||||
import {LegacyHtmlAstTransformer} from 'angular2/src/compiler/legacy_template';
|
||||
import {LegacyHtmlAstTransformer} from '@angular/compiler/src/legacy_template';
|
||||
|
||||
export function main() {
|
||||
describe('Support for legacy template', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Component} from 'angular2/core';
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({styles:<any>('foo'), template: ''})
|
||||
export class MalformedStylesComponent {
|
||||
|
@ -8,14 +8,13 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {IS_DART, stringify} from 'angular2/src/facade/lang';
|
||||
import {CompileMetadataResolver} from 'angular2/src/compiler/metadata_resolver';
|
||||
import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from 'angular2/src/core/metadata/lifecycle_hooks';
|
||||
import {IS_DART, stringify} from '../src/facade/lang';
|
||||
import {CompileMetadataResolver} from '../src/metadata_resolver';
|
||||
import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from '@angular/core/src/metadata/lifecycle_hooks';
|
||||
import {
|
||||
Component,
|
||||
Directive,
|
||||
@ -31,11 +30,11 @@ import {
|
||||
AfterViewChecked,
|
||||
SimpleChange,
|
||||
provide
|
||||
} from 'angular2/core';
|
||||
} from '@angular/core';
|
||||
|
||||
import {TEST_PROVIDERS} from './test_bindings';
|
||||
import {MODULE_SUFFIX} from 'angular2/src/compiler/util';
|
||||
import {PLATFORM_DIRECTIVES} from 'angular2/src/core/platform_directives_and_pipes';
|
||||
import {MODULE_SUFFIX} from '@angular/compiler/src/util';
|
||||
import {PLATFORM_DIRECTIVES} from '@angular/core/src/platform_directives_and_pipes';
|
||||
import {MalformedStylesComponent} from './metadata_resolver_fixture';
|
||||
|
||||
export function main() {
|
||||
|
@ -1,18 +1,22 @@
|
||||
// ATTENTION: This file will be overwritten with generated code by main()
|
||||
import {print, IS_DART} from 'angular2/src/facade/lang';
|
||||
import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter';
|
||||
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
|
||||
import {print, IS_DART} from '../src/facade/lang';
|
||||
import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
import {DartEmitter} from '@angular/compiler/src/output/dart_emitter';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {compileComp, compAMetadata} from './offline_compiler_util';
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
import {ComponentFactory} from '@angular/core/src/linker/component_factory';
|
||||
import {CompA} from './offline_compiler_util';
|
||||
|
||||
export const CompANgFactory: ComponentFactory<CompA> = null;
|
||||
|
||||
export function emit(): Promise<string> {
|
||||
var emitter = IS_DART ? new DartEmitter() : new TypeScriptEmitter();
|
||||
return compileComp(emitter, compAMetadata);
|
||||
}
|
||||
|
||||
// Generator
|
||||
export function main(args: string[]) {
|
||||
var emitter = IS_DART ? new DartEmitter() : new TypeScriptEmitter();
|
||||
compileComp(emitter, compAMetadata)
|
||||
.then((source) => {
|
||||
emit().then((source) => {
|
||||
// debug: console.error(source);
|
||||
print(source);
|
||||
});
|
||||
|
@ -1,17 +1,20 @@
|
||||
// ATTENTION: This file will be overwritten with generated code by main()
|
||||
import {print} from 'angular2/src/facade/lang';
|
||||
import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter';
|
||||
import {print} from '../src/facade/lang';
|
||||
import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter';
|
||||
import {compileComp, compAMetadata} from './offline_compiler_util';
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
import {ComponentFactory} from '@angular/core/src/linker/component_factory';
|
||||
import {CompA} from './offline_compiler_util';
|
||||
|
||||
export const CompANgFactory: ComponentFactory<CompA> = null;
|
||||
|
||||
export function emit() {
|
||||
var emitter = new JavaScriptEmitter();
|
||||
return compileComp(emitter, compAMetadata);
|
||||
}
|
||||
|
||||
// Generator
|
||||
export function main(args: string[]) {
|
||||
var emitter = new JavaScriptEmitter();
|
||||
compileComp(emitter, compAMetadata)
|
||||
.then((source) => {
|
||||
emit().then((source) => {
|
||||
// debug: console.error(source);
|
||||
print(source);
|
||||
});
|
||||
|
@ -8,21 +8,19 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
el
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {Injector} from 'angular2/core';
|
||||
import {IS_DART} from '../src/facade/lang';
|
||||
import {Injector} from '@angular/core';
|
||||
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
import {ComponentFactory} from '@angular/core/src/linker/component_factory';
|
||||
import * as typed from './offline_compiler_codegen_typed';
|
||||
import * as untyped from './offline_compiler_codegen_untyped';
|
||||
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {SharedStylesHost} from "angular2/src/platform/dom/shared_styles_host";
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {SharedStylesHost} from '@angular/platform-browser/src/dom/shared_styles_host';
|
||||
|
||||
import {CompA} from './offline_compiler_util';
|
||||
|
||||
@ -31,13 +29,13 @@ export function main() {
|
||||
var untypedComponentFactory = untyped.CompANgFactory;
|
||||
var fixtures: TestFixture[] = [];
|
||||
|
||||
if (IS_DART || !DOM.supportsDOMEvents()) {
|
||||
if (IS_DART || !getDOM().supportsDOMEvents()) {
|
||||
// Our generator only works on node.js and Dart...
|
||||
fixtures.push(new TestFixture(typedComponentFactory, 'typed'));
|
||||
}
|
||||
if (!IS_DART) {
|
||||
// Our generator only works on node.js and Dart...
|
||||
if (!DOM.supportsDOMEvents()) {
|
||||
if (!getDOM().supportsDOMEvents()) {
|
||||
fixtures.push(new TestFixture(untypedComponentFactory, 'untyped'));
|
||||
}
|
||||
}
|
||||
@ -66,4 +64,4 @@ export function main() {
|
||||
|
||||
class TestFixture {
|
||||
constructor(public compFactory: ComponentFactory<CompA>, public name: string) {}
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,31 @@
|
||||
import {print, IS_DART} from 'angular2/src/facade/lang';
|
||||
import {OutputEmitter} from 'angular2/src/compiler/output/abstract_emitter';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
import {print, IS_DART} from '../src/facade/lang';
|
||||
import {OutputEmitter} from '@angular/compiler/src/output/abstract_emitter';
|
||||
import {Console} from '../core_private';
|
||||
|
||||
import {
|
||||
OfflineCompiler,
|
||||
NormalizedComponentWithViewDirectives,
|
||||
SourceModule
|
||||
} from 'angular2/src/compiler/offline_compiler';
|
||||
import {TemplateParser} from 'angular2/src/compiler/template_parser';
|
||||
import {Parser} from 'angular2/src/compiler/expression_parser/parser';
|
||||
import {Lexer} from 'angular2/src/compiler/expression_parser/lexer';
|
||||
import {HtmlParser} from 'angular2/src/compiler/html_parser';
|
||||
import {StyleCompiler} from 'angular2/src/compiler/style_compiler';
|
||||
import {ViewCompiler} from 'angular2/src/compiler/view_compiler/view_compiler';
|
||||
import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer';
|
||||
import {CompilerConfig} from 'angular2/src/compiler/config';
|
||||
import {createOfflineCompileUrlResolver} from 'angular2/src/compiler/url_resolver';
|
||||
import {MockSchemaRegistry} from './schema_registry_mock';
|
||||
import {MODULE_SUFFIX} from 'angular2/src/compiler/util';
|
||||
import {MockXHR} from 'angular2/src/compiler/xhr_mock';
|
||||
} from '@angular/compiler/src/offline_compiler';
|
||||
import {TemplateParser} from '@angular/compiler/src/template_parser';
|
||||
import {Parser} from '@angular/compiler/src/expression_parser/parser';
|
||||
import {Lexer} from '@angular/compiler/src/expression_parser/lexer';
|
||||
import {HtmlParser} from '@angular/compiler/src/html_parser';
|
||||
import {StyleCompiler} from '@angular/compiler/src/style_compiler';
|
||||
import {ViewCompiler} from '@angular/compiler/src/view_compiler/view_compiler';
|
||||
import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer';
|
||||
import {CompilerConfig} from '@angular/compiler/src/config';
|
||||
import {createOfflineCompileUrlResolver} from '@angular/compiler/src/url_resolver';
|
||||
import {MockSchemaRegistry} from '../testing/schema_registry_mock';
|
||||
import {MODULE_SUFFIX} from '@angular/compiler/src/util';
|
||||
import {MockXHR} from '../testing/xhr_mock';
|
||||
|
||||
import {
|
||||
CompileDirectiveMetadata,
|
||||
CompileTypeMetadata,
|
||||
CompileTemplateMetadata
|
||||
} from 'angular2/src/compiler/compile_metadata';
|
||||
} from '@angular/compiler/src/compile_metadata';
|
||||
|
||||
|
||||
export class CompA { user: string; }
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {escapeSingleQuoteString} from 'angular2/src/compiler/output/abstract_emitter';
|
||||
import {escapeSingleQuoteString} from '@angular/compiler/src/output/abstract_emitter';
|
||||
|
||||
export function main() {
|
||||
describe('AbstractEmitter', () => {
|
||||
|
@ -1,21 +1,18 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
|
||||
import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata';
|
||||
import * as o from 'angular2/src/compiler/output/output_ast';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
import {DartEmitter} from '@angular/compiler/src/output/dart_emitter';
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
|
||||
var someModuleUrl = 'asset:somePackage/lib/somePath';
|
||||
var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath';
|
||||
|
@ -1,21 +1,18 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter';
|
||||
import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata';
|
||||
import * as o from 'angular2/src/compiler/output/output_ast';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter';
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
|
||||
var someModuleUrl = 'asset:somePackage/lib/somePath';
|
||||
var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath';
|
||||
|
@ -1,21 +1,27 @@
|
||||
// ATTENTION: This file will be overwritten with generated code by main()
|
||||
import {print, IS_DART} from 'angular2/src/facade/lang';
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {print, IS_DART} from '../../src/facade/lang';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter';
|
||||
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
|
||||
import * as o from 'angular2/src/compiler/output/output_ast';
|
||||
import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
import {DartEmitter} from '@angular/compiler/src/output/dart_emitter';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
import {assetUrl} from '../../src/util';
|
||||
|
||||
export function getExpressions(): any {
|
||||
return unimplemented();
|
||||
}
|
||||
|
||||
// Generator
|
||||
export function main(args: string[]) {
|
||||
export function emit() {
|
||||
var emitter = IS_DART ? new DartEmitter() : new TypeScriptEmitter();
|
||||
var emittedCode =
|
||||
emitter.emitStatements('asset:angular2/test/compiler/output/output_emitter_codegen_typed',
|
||||
codegenStmts, codegenExportsVars);
|
||||
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);
|
||||
print(emittedCode);
|
||||
}
|
||||
|
@ -1,19 +1,26 @@
|
||||
// ATTENTION: This file will be overwritten with generated code by main()
|
||||
import {print} from 'angular2/src/facade/lang';
|
||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||
import {print} from '../../src/facade/lang';
|
||||
import {unimplemented} from '../../src/facade/exceptions';
|
||||
import {codegenExportsVars, codegenStmts} from './output_emitter_util';
|
||||
import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter';
|
||||
import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter';
|
||||
import {assetUrl} from '../../src/util';
|
||||
|
||||
export function getExpressions(): any {
|
||||
return unimplemented();
|
||||
}
|
||||
|
||||
// Generator
|
||||
export function main(args: string[]) {
|
||||
export function emit () {
|
||||
var emitter = new JavaScriptEmitter();
|
||||
var emittedCode =
|
||||
emitter.emitStatements('asset:angular2/test/compiler/output/output_emitter_codegen_untyped',
|
||||
codegenStmts, codegenExportsVars);
|
||||
emitter.emitStatements(
|
||||
assetUrl('compiler', 'output/output_emitter_codegen_untyped', 'test'),
|
||||
codegenStmts, codegenExportsVars);
|
||||
return emittedCode;
|
||||
}
|
||||
|
||||
export function main(args: string[]) {
|
||||
var emittedCode = emit();
|
||||
// debug: console.error(emittedCode);
|
||||
print(emittedCode);
|
||||
}
|
||||
|
@ -1,29 +1,26 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder,
|
||||
browserDetection
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {IS_DART} from '../../src/facade/lang';
|
||||
|
||||
import * as typed from './output_emitter_codegen_typed';
|
||||
import * as untyped from './output_emitter_codegen_untyped';
|
||||
import {jitStatements} from 'angular2/src/compiler/output/output_jit';
|
||||
import {interpretStatements} from 'angular2/src/compiler/output/output_interpreter';
|
||||
import {jitStatements} from '@angular/compiler/src/output/output_jit';
|
||||
import {interpretStatements} from '@angular/compiler/src/output/output_interpreter';
|
||||
import {codegenStmts, ExternalClass, DynamicClassInstanceFactory} from './output_emitter_util';
|
||||
import {EventEmitter} from 'angular2/src/facade/async';
|
||||
import {ViewType} from 'angular2/src/core/linker/view_type';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {ViewType} from '@angular/core/src/linker/view_type';
|
||||
import {BaseException} from '@angular/core';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {browserDetection} from '@angular/platform-browser/testing'
|
||||
|
||||
export function main() {
|
||||
var outputDefs = [];
|
||||
@ -32,13 +29,13 @@ export function main() {
|
||||
new DynamicClassInstanceFactory()),
|
||||
'name': 'interpreted'
|
||||
});
|
||||
if (IS_DART || !DOM.supportsDOMEvents()) {
|
||||
if (IS_DART || !getDOM().supportsDOMEvents()) {
|
||||
// Our generator only works on node.js and Dart...
|
||||
outputDefs.push({'getExpressions': () => typed.getExpressions, 'name': 'typed'});
|
||||
}
|
||||
if (!IS_DART) {
|
||||
// Our generator only works on node.js and Dart...
|
||||
if (!DOM.supportsDOMEvents()) {
|
||||
if (!getDOM().supportsDOMEvents()) {
|
||||
outputDefs.push({'getExpressions': () => untyped.getExpressions, 'name': 'untyped'});
|
||||
}
|
||||
outputDefs.push({
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata';
|
||||
import {EventEmitter} from 'angular2/src/facade/async';
|
||||
import {ViewType} from 'angular2/src/core/linker/view_type';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
import {InstanceFactory, DynamicInstance} from 'angular2/src/compiler/output/output_interpreter';
|
||||
import {MODULE_SUFFIX} from 'angular2/src/compiler/util';
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import {EventEmitter} from '@angular/core';
|
||||
import {ViewType} from '@angular/core/src/linker/view_type';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {InstanceFactory, DynamicInstance} from '@angular/compiler/src/output/output_interpreter';
|
||||
import {assetUrl} from '@angular/compiler/src/util';
|
||||
|
||||
import * as o from 'angular2/src/compiler/output/output_ast';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
|
||||
export class ExternalClass {
|
||||
changeable: any;
|
||||
@ -15,25 +15,25 @@ export class ExternalClass {
|
||||
|
||||
var testDataIdentifier = new CompileIdentifierMetadata({
|
||||
name: 'ExternalClass',
|
||||
moduleUrl: `asset:angular2/test/compiler/output/output_emitter_util${MODULE_SUFFIX}`,
|
||||
moduleUrl: assetUrl('compiler', 'output/output_emitter_util'),
|
||||
runtime: ExternalClass
|
||||
});
|
||||
|
||||
var eventEmitterIdentifier = new CompileIdentifierMetadata({
|
||||
name: 'EventEmitter',
|
||||
moduleUrl: `asset:angular2/lib/src/facade/async${MODULE_SUFFIX}`,
|
||||
moduleUrl: assetUrl('core'),
|
||||
runtime: EventEmitter
|
||||
});
|
||||
|
||||
var enumIdentifier = new CompileIdentifierMetadata({
|
||||
name: 'ViewType.HOST',
|
||||
moduleUrl: `asset:angular2/lib/src/core/linker/view_type${MODULE_SUFFIX}`,
|
||||
moduleUrl: assetUrl('core', 'linker/view_type'),
|
||||
runtime: ViewType.HOST
|
||||
});
|
||||
|
||||
var baseExceptionIdentifier = new CompileIdentifierMetadata({
|
||||
name: 'BaseException',
|
||||
moduleUrl: `asset:angular2/lib/src/facade/exceptions${MODULE_SUFFIX}`,
|
||||
moduleUrl: assetUrl('core'),
|
||||
runtime: BaseException
|
||||
});
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {getImportModulePath, ImportEnv} from 'angular2/src/compiler/output/path_util';
|
||||
import {getImportModulePath, ImportEnv} from '@angular/compiler/src/output/path_util';
|
||||
|
||||
export function main() {
|
||||
describe('PathUtils', () => {
|
||||
@ -69,4 +66,4 @@ export function main() {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
TestComponentBuilder
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {isBlank} from 'angular2/src/facade/lang';
|
||||
import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter';
|
||||
import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata';
|
||||
import * as o from 'angular2/src/compiler/output/output_ast';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter';
|
||||
import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata';
|
||||
import * as o from '@angular/compiler/src/output/output_ast';
|
||||
|
||||
var someModuleUrl = 'asset:somePackage/lib/somePath';
|
||||
var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath';
|
||||
|
@ -8,30 +8,46 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry';
|
||||
import {DomElementSchemaRegistry} from '@angular/compiler/src/schema/dom_element_schema_registry';
|
||||
import {extractSchema} from './schema_extractor';
|
||||
|
||||
export function main() {
|
||||
// DOMElementSchema can only be used on the JS side where we can safely
|
||||
// use reflection for DOM elements
|
||||
if (IS_DART) return;
|
||||
|
||||
var registry: DomElementSchemaRegistry;
|
||||
|
||||
beforeEach(() => { registry = new DomElementSchemaRegistry(); });
|
||||
|
||||
describe('DOMElementSchema', () => {
|
||||
var registry: DomElementSchemaRegistry;
|
||||
beforeEach(() => { registry = new DomElementSchemaRegistry(); });
|
||||
|
||||
it('should detect properties on regular elements', () => {
|
||||
expect(registry.hasProperty('div', 'id')).toBeTruthy();
|
||||
expect(registry.hasProperty('div', 'title')).toBeTruthy();
|
||||
expect(registry.hasProperty('h1', 'align')).toBeTruthy();
|
||||
expect(registry.hasProperty('h2', 'align')).toBeTruthy();
|
||||
expect(registry.hasProperty('h3', 'align')).toBeTruthy();
|
||||
expect(registry.hasProperty('h4', 'align')).toBeTruthy();
|
||||
expect(registry.hasProperty('h5', 'align')).toBeTruthy();
|
||||
expect(registry.hasProperty('h6', 'align')).toBeTruthy();
|
||||
expect(registry.hasProperty('h7', 'align')).toBeFalsy();
|
||||
expect(registry.hasProperty('textarea', 'disabled')).toBeTruthy();
|
||||
expect(registry.hasProperty('input', 'disabled')).toBeTruthy();
|
||||
expect(registry.hasProperty('div', 'unknown')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return true for custom-like elements',
|
||||
() => { expect(registry.hasProperty('custom-like', 'unknown')).toBeTruthy(); });
|
||||
it('should detect different kinds of types',
|
||||
() => {
|
||||
// inheritance: video => media => *
|
||||
expect(registry.hasProperty('video', 'className')).toBeTruthy(); // from *
|
||||
expect(registry.hasProperty('video', 'id')).toBeTruthy(); // string
|
||||
expect(registry.hasProperty('video', 'scrollLeft')).toBeTruthy(); // number
|
||||
expect(registry.hasProperty('video', 'height')).toBeTruthy(); // number
|
||||
expect(registry.hasProperty('video', 'autoplay')).toBeTruthy(); // boolean
|
||||
expect(registry.hasProperty('video', 'classList')).toBeTruthy(); // object
|
||||
// from *; but events are not properties
|
||||
expect(registry.hasProperty('video', 'click')).toBeFalsy();
|
||||
})
|
||||
|
||||
it('should return true for custom-like elements',
|
||||
() => { expect(registry.hasProperty('custom-like', 'unknown')).toBeTruthy(); });
|
||||
|
||||
it('should re-map property names that are specified in DOM facade',
|
||||
() => { expect(registry.getMappedPropName('readonly')).toEqual('readOnly'); });
|
||||
@ -43,5 +59,15 @@ export function main() {
|
||||
|
||||
it('should detect properties on namespaced elements',
|
||||
() => { expect(registry.hasProperty('@svg:g', 'id')).toBeTruthy(); });
|
||||
|
||||
it('generate a new schema', () => {
|
||||
// console.log(JSON.stringify(registry.properties));
|
||||
extractSchema(
|
||||
(descriptors) => {
|
||||
// Uncomment this line to see:
|
||||
// the generated schema which can then be pasted to the DomElementSchemaRegistry
|
||||
// console.log(descriptors);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* We don't know how to extract schema in dart, so do nothing.
|
||||
*/
|
||||
extractSchema(fn(List<String> descriptors)) {
|
||||
}
|
140
modules/@angular/compiler/test/schema/schema_extractor.ts
Normal file
140
modules/@angular/compiler/test/schema/schema_extractor.ts
Normal file
@ -0,0 +1,140 @@
|
||||
import {isString, isPresent} from '../../src/facade/lang';
|
||||
|
||||
const SVG_PREFIX = '@svg:';
|
||||
|
||||
var document = typeof global['document'] == 'object' ? global['document'] : null;
|
||||
|
||||
export function extractSchema(fn: (descriptors: string[]) => void): string[] {
|
||||
var SVGGraphicsElement = global['SVGGraphicsElement'];
|
||||
var SVGAnimationElement = global['SVGAnimationElement'];
|
||||
var SVGGeometryElement = global['SVGGeometryElement'];
|
||||
var SVGComponentTransferFunctionElement = global['SVGComponentTransferFunctionElement'];
|
||||
var SVGGradientElement = global['SVGGradientElement'];
|
||||
var SVGTextContentElement = global['SVGTextContentElement'];
|
||||
var SVGTextPositioningElement = global['SVGTextPositioningElement'];
|
||||
if (!document || !SVGGraphicsElement) return null;
|
||||
var descriptors: string[] = [];
|
||||
var visited: {[name: string]: boolean} = {};
|
||||
var element = document.createElement('video');
|
||||
var svgAnimation = document.createElementNS('http://www.w3.org/2000/svg', 'set');
|
||||
var svgPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
||||
var svgFeFuncA = document.createElementNS('http://www.w3.org/2000/svg', 'feFuncA');
|
||||
var svgGradient = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient');
|
||||
var svgText = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
|
||||
extractProperties(Element, element, visited, descriptors, '*', '');
|
||||
extractProperties(HTMLElement, element, visited, descriptors, '', '*');
|
||||
extractProperties(HTMLMediaElement, element, visited, descriptors, 'media', '');
|
||||
extractProperties(SVGElement, svgText, visited, descriptors, SVG_PREFIX, '*');
|
||||
extractProperties(SVGGraphicsElement, svgText, visited, descriptors, SVG_PREFIX + 'graphics',
|
||||
SVG_PREFIX);
|
||||
extractProperties(SVGAnimationElement, svgAnimation, visited, descriptors,
|
||||
SVG_PREFIX + 'animation', SVG_PREFIX);
|
||||
extractProperties(SVGGeometryElement, svgPath, visited, descriptors, SVG_PREFIX + 'geometry',
|
||||
SVG_PREFIX);
|
||||
extractProperties(SVGComponentTransferFunctionElement, svgFeFuncA, visited, descriptors,
|
||||
SVG_PREFIX + 'componentTransferFunction', SVG_PREFIX);
|
||||
extractProperties(SVGGradientElement, svgGradient, visited, descriptors, SVG_PREFIX + 'gradient',
|
||||
SVG_PREFIX);
|
||||
extractProperties(SVGTextContentElement, svgText, visited, descriptors,
|
||||
SVG_PREFIX + 'textContent', SVG_PREFIX + 'graphics');
|
||||
extractProperties(SVGTextPositioningElement, svgText, visited, descriptors,
|
||||
SVG_PREFIX + 'textPositioning', SVG_PREFIX + 'textContent');
|
||||
var keys = Object.getOwnPropertyNames(window).filter(
|
||||
k => k.endsWith('Element') && (k.startsWith('HTML') || k.startsWith('SVG')));
|
||||
keys.sort();
|
||||
keys.forEach(name => extractRecursiveProperties(visited, descriptors, window[name]));
|
||||
fn(descriptors);
|
||||
}
|
||||
|
||||
function extractRecursiveProperties(visited: {[name: string]: boolean}, descriptors: string[],
|
||||
type: Function): string {
|
||||
var name = extractName(type);
|
||||
if (visited[name]) return name; // already been here
|
||||
var superName = '';
|
||||
if (name != '*') {
|
||||
superName =
|
||||
extractRecursiveProperties(visited, descriptors, type.prototype.__proto__.constructor);
|
||||
}
|
||||
|
||||
var instance: HTMLElement = null;
|
||||
name.split(',').forEach(tagName => {
|
||||
instance = isSVG(type) ?
|
||||
document.createElementNS('http://www.w3.org/2000/svg',
|
||||
tagName.replace(SVG_PREFIX, '')) :
|
||||
document.createElement(tagName);
|
||||
var htmlType = type;
|
||||
if (tagName == 'cite') htmlType = HTMLElement;
|
||||
if (!(instance instanceof htmlType)) {
|
||||
throw new Error(`Tag <${tagName}> is not an instance of ${htmlType['name']}`);
|
||||
}
|
||||
});
|
||||
extractProperties(type, instance, visited, descriptors, name, superName);
|
||||
return name;
|
||||
}
|
||||
|
||||
function extractProperties(type: Function, instance: any, visited: {[name: string]: boolean},
|
||||
descriptors: string[], name: string, superName: string) {
|
||||
if (!type) return;
|
||||
visited[name] = true;
|
||||
var props = <string[]>[];
|
||||
var prototype = type.prototype;
|
||||
var keys = Object.getOwnPropertyNames(prototype);
|
||||
keys.sort();
|
||||
keys.forEach((n) => {
|
||||
if (n.startsWith('on')) {
|
||||
props.push('*' + n.substr(2));
|
||||
} else {
|
||||
var typeCh = typeMap[typeof instance[n]];
|
||||
var descriptor = Object.getOwnPropertyDescriptor(prototype, n);
|
||||
var isSetter = descriptor && isPresent(descriptor.set);
|
||||
if (isString(typeCh) && !n.startsWith('webkit') && isSetter) {
|
||||
props.push(typeCh + n);
|
||||
}
|
||||
}
|
||||
});
|
||||
descriptors.push(name + (superName ? '^' + superName : '') + '|' + props.join(','));
|
||||
}
|
||||
|
||||
function extractName(type: Function): string {
|
||||
var name = type['name'];
|
||||
if (name == 'Element') return '*';
|
||||
if (name == 'HTMLImageElement') return 'img';
|
||||
if (name == 'HTMLAnchorElement') return 'a';
|
||||
if (name == 'HTMLDListElement') return 'dl';
|
||||
if (name == 'HTMLDirectoryElement') return 'dir';
|
||||
if (name == 'HTMLHeadingElement') return 'h1,h2,h3,h4,h5,h6';
|
||||
if (name == 'HTMLModElement') return 'ins,del';
|
||||
if (name == 'HTMLOListElement') return 'ol';
|
||||
if (name == 'HTMLParagraphElement') return 'p';
|
||||
if (name == 'HTMLQuoteElement') return 'q,blockquote,cite';
|
||||
if (name == 'HTMLTableCaptionElement') return 'caption';
|
||||
if (name == 'HTMLTableCellElement') return 'th,td';
|
||||
if (name == 'HTMLTableColElement') return 'col,colgroup';
|
||||
if (name == 'HTMLTableRowElement') return 'tr';
|
||||
if (name == 'HTMLTableSectionElement') return 'tfoot,thead,tbody';
|
||||
if (name == 'HTMLUListElement') return 'ul';
|
||||
if (name == 'SVGGraphicsElement') return SVG_PREFIX + 'graphics';
|
||||
if (name == 'SVGMPathElement') return SVG_PREFIX + 'mpath';
|
||||
if (name == 'SVGSVGElement') return SVG_PREFIX + 'svg';
|
||||
if (name == 'SVGTSpanElement') return SVG_PREFIX + 'tspan';
|
||||
var isSVG = name.startsWith('SVG');
|
||||
if (name.startsWith('HTML') || isSVG) {
|
||||
name = name.replace('HTML', '').replace('SVG', '').replace('Element', '');
|
||||
if (isSVG && name.startsWith('FE')) {
|
||||
name = 'fe' + name.substring(2);
|
||||
} else if (name) {
|
||||
name = name.charAt(0).toLowerCase() + name.substring(1);
|
||||
}
|
||||
return isSVG ? SVG_PREFIX + name : name.toLowerCase();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function isSVG(type: Function): boolean {
|
||||
return type['name'].startsWith('SVG');
|
||||
}
|
||||
|
||||
const typeMap =
|
||||
<{[type: string]: string}>{'string': '', 'number': '#', 'boolean': '!', 'object': '%'};
|
@ -1,7 +1,8 @@
|
||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/testing_internal';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
import {SelectorMatcher, CssSelector} from 'angular2/src/compiler/selector';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit} from '@angular/core/testing';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {SelectorMatcher} from '@angular/compiler/src/selector';
|
||||
import {CssSelector} from '@angular/compiler/src/selector';
|
||||
import {el} from '@angular/platform-browser/testing';
|
||||
|
||||
export function main() {
|
||||
describe('SelectorMatcher', () => {
|
||||
@ -94,7 +95,7 @@ export function main() {
|
||||
|
||||
var elementSelector = new CssSelector();
|
||||
var element = el('<div attr></div>');
|
||||
var empty = DOM.getAttribute(element, 'attr');
|
||||
var empty = getDOM().getAttribute(element, 'attr');
|
||||
elementSelector.addAttribute('some-decor', empty);
|
||||
matcher.match(elementSelector, selectableCollector);
|
||||
expect(matched).toEqual([s1[0], 1]);
|
||||
|
@ -5,13 +5,11 @@ import {
|
||||
expect,
|
||||
ddescribe,
|
||||
iit,
|
||||
SpyObject,
|
||||
el,
|
||||
normalizeCSS
|
||||
} from 'angular2/testing_internal';
|
||||
import {ShadowCss, processRules, CssRule} from 'angular2/src/compiler/shadow_css';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {ShadowCss, processRules, CssRule} from '@angular/compiler/src/shadow_css';
|
||||
|
||||
import {RegExpWrapper, StringWrapper, isPresent} from 'angular2/src/facade/lang';
|
||||
import {RegExpWrapper, StringWrapper, isPresent} from '../src/facade/lang';
|
||||
import {normalizeCSS} from '@angular/platform-browser/testing';
|
||||
|
||||
export function main() {
|
||||
describe('ShadowCss', function() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {XHR} from '@angular/compiler/src/xhr';
|
||||
|
||||
import {SpyObject, proxy} from 'angular2/testing_internal';
|
||||
import {SpyObject, proxy} from '@angular/core/testing/testing_internal';
|
||||
|
||||
export class SpyXHR extends SpyObject {
|
||||
constructor() { super(XHR); }
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/testing_internal';
|
||||
import {extractStyleUrls, isStyleUrlResolvable} from 'angular2/src/compiler/style_url_resolver';
|
||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit} from '@angular/core/testing';
|
||||
import {extractStyleUrls, isStyleUrlResolvable} from '@angular/compiler/src/style_url_resolver';
|
||||
|
||||
import {UrlResolver} from 'angular2/src/compiler/url_resolver';
|
||||
import {UrlResolver} from '@angular/compiler/src/url_resolver';
|
||||
|
||||
export function main() {
|
||||
describe('extractStyleUrls', () => {
|
||||
|
@ -9,17 +9,16 @@ import {
|
||||
afterEach,
|
||||
inject,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
import {provide} from 'angular2/src/core/di';
|
||||
import {Console} from 'angular2/src/core/console';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {provide} from '@angular/core';
|
||||
|
||||
import {Console} from '@angular/core/src/console';
|
||||
|
||||
import {TEST_PROVIDERS} from './test_bindings';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {
|
||||
TemplateParser,
|
||||
splitClasses,
|
||||
TEMPLATE_TRANSFORMS
|
||||
} from 'angular2/src/compiler/template_parser';
|
||||
} from '@angular/compiler/src/template_parser';
|
||||
import {
|
||||
CompileDirectiveMetadata,
|
||||
CompilePipeMetadata,
|
||||
@ -29,7 +28,7 @@ import {
|
||||
CompileTokenMetadata,
|
||||
CompileDiDependencyMetadata,
|
||||
CompileQueryMetadata
|
||||
} from 'angular2/src/compiler/compile_metadata';
|
||||
} from '@angular/compiler/src/compile_metadata';
|
||||
import {
|
||||
templateVisitAll,
|
||||
TemplateAstVisitor,
|
||||
@ -48,13 +47,14 @@ import {
|
||||
PropertyBindingType,
|
||||
DirectiveAst,
|
||||
ProviderAstType
|
||||
} from 'angular2/src/compiler/template_ast';
|
||||
import {identifierToken, Identifiers} from 'angular2/src/compiler/identifiers';
|
||||
} from '@angular/compiler/src/template_ast';
|
||||
import {identifierToken, Identifiers} from '../src/identifiers';
|
||||
|
||||
import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
|
||||
import {MockSchemaRegistry} from './schema_registry_mock';
|
||||
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry';
|
||||
import {MockSchemaRegistry} from '@angular/compiler/testing';
|
||||
|
||||
import {Unparser} from './expression_parser/unparser';
|
||||
import {TEST_PROVIDERS} from './test_bindings';
|
||||
|
||||
var expressionUnparser = new Unparser();
|
||||
|
||||
@ -1649,4 +1649,4 @@ class ArrayConsole implements Console {
|
||||
warnings: string[] = [];
|
||||
log(msg: string) { this.logs.push(msg); }
|
||||
warn(msg: string) { this.warnings.push(msg); }
|
||||
}
|
||||
}
|
||||
|
@ -8,17 +8,16 @@ import {
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
beforeEachProviders
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {HtmlParser} from 'angular2/src/compiler/html_parser';
|
||||
import {HtmlParser} from '@angular/compiler/src/html_parser';
|
||||
import {
|
||||
preparseElement,
|
||||
PreparsedElementType,
|
||||
PreparsedElement
|
||||
} from 'angular2/src/compiler/template_preparser';
|
||||
} from '@angular/compiler/src/template_preparser';
|
||||
|
||||
export function main() {
|
||||
describe('preparseElement', () => {
|
||||
|
@ -1,14 +1,9 @@
|
||||
import {provide, Provider} from 'angular2/src/core/di';
|
||||
import {MockSchemaRegistry} from './schema_registry_mock';
|
||||
import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
|
||||
import {MockXHR} from 'angular2/src/compiler/xhr_mock';
|
||||
import {XHR} from 'angular2/src/compiler/xhr';
|
||||
import {
|
||||
UrlResolver,
|
||||
createUrlResolverWithoutPackagePrefix
|
||||
} from 'angular2/src/compiler/url_resolver';
|
||||
import {provide} from '@angular/core';
|
||||
import {MockSchemaRegistry, MockXHR} from '@angular/compiler/testing';
|
||||
import {ElementSchemaRegistry, XHR, UrlResolver} from '@angular/compiler';
|
||||
import {createUrlResolverWithoutPackagePrefix} from '@angular/compiler/src/url_resolver';
|
||||
|
||||
export var TEST_PROVIDERS = [
|
||||
export var TEST_PROVIDERS: any[] = [
|
||||
provide(ElementSchemaRegistry, {useValue: new MockSchemaRegistry({}, {})}),
|
||||
provide(XHR, {useClass: MockXHR}),
|
||||
provide(UrlResolver, {useFactory: createUrlResolverWithoutPackagePrefix})
|
||||
|
@ -1,27 +1,27 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
dispatchEvent,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
withProviders,
|
||||
it,
|
||||
xit,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {
|
||||
TestComponentBuilder,
|
||||
ComponentFixtureAutoDetect,
|
||||
ComponentFixtureNoNgZone
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {Injectable, provide, ComponentResolver} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {Directive, Component, ViewMetadata, Input} from 'angular2/src/core/metadata';
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
} from '@angular/compiler/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {Injectable, provide, Component, Input, ViewMetadata, ComponentResolver} from '@angular/core';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {IS_DART} from '../src/facade/lang';
|
||||
import {PromiseWrapper} from '../src/facade/promise';
|
||||
import {dispatchEvent} from "@angular/platform-browser/testing";
|
||||
import {withProviders} from "@angular/core/testing/test_injector"
|
||||
|
||||
@Component(
|
||||
{selector: 'child-comp', template: `<span>Original {{childBinding}}</span>`, directives: []})
|
||||
|
@ -6,11 +6,10 @@ import {
|
||||
ddescribe,
|
||||
iit,
|
||||
xit,
|
||||
el,
|
||||
inject
|
||||
} from 'angular2/testing_internal';
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {UrlResolver, createOfflineCompileUrlResolver} from 'angular2/src/compiler/url_resolver';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {IS_DART} from '../src/facade/lang';
|
||||
import {UrlResolver, createOfflineCompileUrlResolver} from '@angular/compiler/src/url_resolver';
|
||||
|
||||
export function main() {
|
||||
describe('UrlResolver', () => {
|
||||
|
@ -2,17 +2,15 @@ import {
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
it,
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {stringify, isBlank} from 'angular2/src/facade/lang';
|
||||
|
||||
import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
|
||||
|
||||
import {Component, ViewMetadata} from 'angular2/src/core/metadata';
|
||||
import {stringify} from '../src/facade/lang';
|
||||
import {MockViewResolver} from '../testing';
|
||||
import {Component, ViewMetadata} from '@angular/core';
|
||||
import {isBlank} from '../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe('MockViewResolver', () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/testing_internal';
|
||||
import {ViewResolver} from 'angular2/src/compiler/view_resolver';
|
||||
import {Component, ViewMetadata} from 'angular2/src/core/metadata';
|
||||
import {ddescribe, describe, it, iit, expect, beforeEach} from '@angular/core/testing';
|
||||
import {ViewResolver} from '@angular/compiler/src/view_resolver';
|
||||
import {Component, ViewMetadata} from '@angular/core/src/metadata';
|
||||
|
||||
class SomeDir {}
|
||||
class SomePipe {}
|
||||
|
@ -1,17 +1,16 @@
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
} from 'angular2/testing_internal';
|
||||
import {MockXHR} from 'angular2/src/compiler/xhr_mock';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {MockXHR} from '@angular/compiler/testing';
|
||||
import {PromiseWrapper} from '../src/facade/async';
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe('MockXHR', () => {
|
||||
|
Reference in New Issue
Block a user