feat(compiler): DOM adapters + html5lib implementation; misc fixes
This commit is contained in:
9
modules/angular2/test/core/compiler/compiler_browser_spec.js
vendored
Normal file
9
modules/angular2/test/core/compiler/compiler_browser_spec.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Runs compiler tests using in-browser DOM adapter.
|
||||
*/
|
||||
|
||||
import {runCompilerCommonTests} from './compiler_common_tests';
|
||||
|
||||
export function main() {
|
||||
runCompilerCommonTests();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import {describe, beforeEach, it, expect, ddescribe, iit, el, IS_DARTIUM} from 'angular2/test_lib';
|
||||
|
||||
import {DOM, Element, TemplateElement} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {List, ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Type, isBlank, stringify, isPresent} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
@ -22,7 +22,7 @@ import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
|
||||
import {Lexer, Parser, dynamicChangeDetection} from 'angular2/change_detection';
|
||||
import {ShadowDomStrategy, NativeShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
|
||||
|
||||
export function main() {
|
||||
export function runCompilerCommonTests() {
|
||||
describe('compiler', function() {
|
||||
StringMapWrapper.forEach({
|
||||
'(sync TemplateLoader)': true,
|
@ -0,0 +1,9 @@
|
||||
library angular2.compiler.html5lib_dom_adapter.test;
|
||||
|
||||
import 'package:angular2/src/dom/html5lib_adapter.dart';
|
||||
import 'compiler_common_tests.dart';
|
||||
|
||||
void main() {
|
||||
Html5LibDomAdapter.makeCurrent();
|
||||
runCompilerCommonTests();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import {describe, xit, it, expect, beforeEach, ddescribe, iit, el} from 'angular2/test_lib';
|
||||
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Type, isPresent, BaseException} from 'angular2/src/facade/lang';
|
||||
import {assertionsEnabled, isJsObject} from 'angular2/src/facade/lang';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {describe, beforeEach, it, expect, iit, ddescribe, el} from 'angular2/test_lib';
|
||||
import {isPresent, normalizeBlank} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ElementBinderBuilder} from 'angular2/src/core/compiler/pipeline/element_binder_builder';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {describe, beforeEach, it, expect, iit, ddescribe, el} from 'angular2/test_lib';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ElementBindingMarker} from 'angular2/src/core/compiler/pipeline/element_binding_marker';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {describe, beforeEach, it, expect, iit, ddescribe, el} from 'angular2/test_lib';
|
||||
import {ListWrapper, List, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {isPresent, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
||||
|
||||
import {CompilePipeline} from 'angular2/src/core/compiler/pipeline/compile_pipeline';
|
||||
|
@ -15,16 +15,18 @@ import {ProtoElementInjector} from 'angular2/src/core/compiler/element_injector'
|
||||
export function main() {
|
||||
describe('ProtoElementInjectorBuilder', () => {
|
||||
var protoElementInjectorBuilder, protoView;
|
||||
// Create consts for an elements with a var- so that we can fake parsing the var into
|
||||
// the CompileElement's variableBindings without actually doing any parsing.
|
||||
var ELEMENT_WITH_VAR;
|
||||
var DIRECTIVE_ELEMENT_WITH_VAR;
|
||||
|
||||
beforeEach( () => {
|
||||
ELEMENT_WITH_VAR = el('<div var-name></div>');
|
||||
DIRECTIVE_ELEMENT_WITH_VAR = el('<div var-name directives></div>');
|
||||
protoElementInjectorBuilder = new TestableProtoElementInjectorBuilder();
|
||||
protoView = new ProtoView(null, null, null);
|
||||
});
|
||||
|
||||
// Create consts for an elements with a var- so that we can fake parsing the var into
|
||||
// the CompileElement's variableBindings without actually doing any parsing.
|
||||
var ELEMENT_WITH_VAR = el('<div var-name></div>');
|
||||
var DIRECTIVE_ELEMENT_WITH_VAR = el('<div var-name directives></div>');
|
||||
|
||||
function createPipeline(directives = null) {
|
||||
if (isBlank(directives)) {
|
||||
directives = [];
|
||||
|
@ -22,7 +22,7 @@ import {ShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy'
|
||||
import {ProtoView} from 'angular2/src/core/compiler/view';
|
||||
|
||||
import {IMPLEMENTS, Type, stringify} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
export function main() {
|
||||
|
@ -11,7 +11,7 @@ import {DirectiveMetadata} from 'angular2/src/core/compiler/directive_metadata';
|
||||
import {ShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
|
||||
|
||||
import {Type, isBlank, stringify} from 'angular2/src/facade/lang';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
export function main() {
|
||||
describe('ShimShadowDom', () => {
|
||||
@ -62,12 +62,12 @@ class FakeStrategy extends ShadowDomStrategy {
|
||||
super();
|
||||
}
|
||||
|
||||
shimContentElement(component: Type, element: Element) {
|
||||
shimContentElement(component: Type, element) {
|
||||
var attrName = stringify(component) + '-content';
|
||||
DOM.setAttribute(element, attrName, '');
|
||||
}
|
||||
|
||||
shimHostElement(component: Type, element: Element) {
|
||||
shimHostElement(component: Type, element) {
|
||||
var attrName = stringify(component) + '-host';
|
||||
DOM.setAttribute(element, attrName, '');
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ViewSplitter} from 'angular2/src/core/compiler/pipeline/view_splitter';
|
||||
import {CompilePipeline} from 'angular2/src/core/compiler/pipeline/compile_pipeline';
|
||||
import {DOM, TemplateElement} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {Lexer, Parser} from 'angular2/change_detection';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {describe, beforeEach, it, expect, ddescribe, iit, SpyObject, el, proxy} from 'angular2/test_lib';
|
||||
import {IMPLEMENTS} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Content} from 'angular2/src/core/compiler/shadow_dom_emulation/content_tag';
|
||||
import {NgElement} from 'angular2/src/core/dom/element';
|
||||
import {LightDom} from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {describe, beforeEach, it, expect, ddescribe, iit, SpyObject, el, proxy} from 'angular2/test_lib';
|
||||
import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Content} from 'angular2/src/core/compiler/shadow_dom_emulation/content_tag';
|
||||
import {LightDom} from 'angular2/src/core/compiler/shadow_dom_emulation/light_dom';
|
||||
import {View} from 'angular2/src/core/compiler/view';
|
||||
|
@ -2,7 +2,7 @@ import {describe, xit, it, expect, beforeEach, ddescribe, iit, el} from 'angular
|
||||
|
||||
import {StringMapWrapper, List} from 'angular2/src/facade/collection';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {Injector} from 'angular2/di';
|
||||
import {Lexer, Parser, ChangeDetector, dynamicChangeDetection} from 'angular2/change_detection';
|
||||
@ -29,7 +29,10 @@ import {Template} from 'angular2/src/core/annotations/template';
|
||||
|
||||
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
|
||||
|
||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||
|
||||
export function main() {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
describe('integration tests', function() {
|
||||
var urlResolver = new UrlResolver();
|
||||
var styleUrlResolver = new StyleUrlResolver(urlResolver);
|
||||
|
@ -13,7 +13,7 @@ import {ProtoView} from 'angular2/src/core/compiler/view';
|
||||
import {XHR} from 'angular2/src/core/compiler/xhr/xhr';
|
||||
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
||||
|
||||
import {TemplateLoader} from 'angular2/src/core/compiler/template_loader';
|
||||
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
|
||||
|
||||
import {Template} from 'angular2/src/core/annotations/template';
|
||||
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
import {XHRMock} from 'angular2/src/mock/xhr_mock';
|
||||
|
||||
export function main() {
|
||||
|
@ -2,7 +2,7 @@ import {describe, xit, it, expect, beforeEach, ddescribe, iit, el, proxy} from '
|
||||
import {View, ProtoView} from 'angular2/src/core/compiler/view';
|
||||
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
|
||||
import {IMPLEMENTS} from 'angular2/src/facade/lang';
|
||||
import {DOM, Node} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {Injector} from 'angular2/di';
|
||||
import {ProtoElementInjector, ElementInjector} from 'angular2/src/core/compiler/element_injector';
|
||||
@ -33,7 +33,7 @@ class AttachableChangeDetector {
|
||||
@IMPLEMENTS(View)
|
||||
class HydrateAwareFakeView {
|
||||
isHydrated: boolean;
|
||||
nodes: List<Node>;
|
||||
nodes: List;
|
||||
changeDetector: ChangeDetector;
|
||||
rootElementInjectors;
|
||||
constructor(isHydrated) {
|
||||
|
@ -8,7 +8,7 @@ import {Lexer, Parser, DynamicProtoChangeDetector,
|
||||
ChangeDetector} from 'angular2/change_detection';
|
||||
import {EventEmitter} from 'angular2/src/core/annotations/events';
|
||||
import {List, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOM, Element} from 'angular2/src/facade/dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {int, IMPLEMENTS} from 'angular2/src/facade/lang';
|
||||
import {Injector} from 'angular2/di';
|
||||
import {View} from 'angular2/src/core/compiler/view';
|
||||
|
Reference in New Issue
Block a user