chore(build): run application tests in Node

Closes #1423
This commit is contained in:
Marc Laval 2015-04-16 18:44:34 +02:00
parent fbd6851860
commit aabe83cf63
3 changed files with 15 additions and 9 deletions

View File

@ -214,7 +214,6 @@ var CONFIG = {
} }
}; };
CONFIG.test.js.cjs = CONFIG.test.js.cjs.map(function(s) {return CONFIG.dest.js.cjs + s}); CONFIG.test.js.cjs = CONFIG.test.js.cjs.map(function(s) {return CONFIG.dest.js.cjs + s});
CONFIG.test.js.cjs.push('!**/core/application_spec.js'); //Disabled in nodejs because it relies on Zone.js
CONFIG.test.js.cjs.push('!**/core/zone/vm_turn_zone_spec.js'); //Disabled in nodejs because it relies on Zone.js CONFIG.test.js.cjs.push('!**/core/zone/vm_turn_zone_spec.js'); //Disabled in nodejs because it relies on Zone.js
CONFIG.test.js.cjs.push('!**/render/dom/events/event_manager_spec.js'); //Disabled in nodejs because it relies on DOM events CONFIG.test.js.cjs.push('!**/render/dom/events/event_manager_spec.js'); //Disabled in nodejs because it relies on DOM events

View File

@ -1,4 +1,5 @@
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability'; import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
import {global} from 'angular2/src/facade/lang';
class PublicTestability { class PublicTestability {
_testabililty: Testability; _testabililty: Testability;
@ -18,10 +19,10 @@ class PublicTestability {
export class GetTestability { export class GetTestability {
static addToWindow(registry: TestabilityRegistry) { static addToWindow(registry: TestabilityRegistry) {
if (!window.angular2) { if (!global.angular2) {
window.angular2 = {}; global.angular2 = {};
} }
window.angular2.getTestability = function(elem): PublicTestability { global.angular2.getTestability = function(elem): PublicTestability {
var testability = registry.findTestabilityInTree(elem); var testability = registry.findTestabilityInTree(elem);
if (testability == null) { if (testability == null) {
@ -29,7 +30,7 @@ export class GetTestability {
} }
return new PublicTestability(testability); return new PublicTestability(testability);
}; };
window.angular2.resumeBootstrap = function() { global.angular2.resumeBootstrap = function() {
// Intentionally left blank. This will allow Protractor to run // Intentionally left blank. This will allow Protractor to run
// against angular2 without turning off Angular synchronization. // against angular2 without turning off Angular synchronization.
}; };

View File

@ -370,13 +370,19 @@ export class Parse5DomAdapter extends DomAdapter {
return this.isTemplateElement(el) ? this.content(el) : el; return this.isTemplateElement(el) ? this.content(el) : el;
} }
createHtmlDocument() { createHtmlDocument() {
throw _notImplemented('createHtmlDocument'); var newDoc = treeAdapter.createDocument();
newDoc.title = "fake title";
var head = treeAdapter.createElement("head", null, []);
var body = treeAdapter.createElement("body", 'http://www.w3.org/1999/xhtml', []);
this.appendChild(newDoc, head);
this.appendChild(newDoc, body);
StringMapWrapper.set(newDoc, "head", head);
StringMapWrapper.set(newDoc, "body", body);
return newDoc;
} }
defaultDoc() { defaultDoc() {
if (defDoc === null) { if (defDoc === null) {
defDoc = StringMapWrapper.create(); defDoc = this.createHtmlDocument();
defDoc.title = "Default title";
StringMapWrapper.set(defDoc, "head", treeAdapter.createElement("head", null, []));
} }
return defDoc; return defDoc;
} }