diff --git a/modules/angular2/src/test_lib/test_component_builder.ts b/modules/angular2/src/test_lib/test_component_builder.ts index a0d596e916..bac1d582b9 100644 --- a/modules/angular2/src/test_lib/test_component_builder.ts +++ b/modules/angular2/src/test_lib/test_component_builder.ts @@ -138,6 +138,10 @@ export class TestComponentBuilder { var doc = this._injector.get(DOCUMENT_TOKEN); // TODO(juliemr): can/should this be optional? + var oldRoots = DOM.querySelectorAll(doc, '[id^=root]'); + for (var i = 0; i < oldRoots.length; i++) { + DOM.remove(oldRoots[i]); + } DOM.appendChild(doc.body, rootEl); diff --git a/modules/angular2/src/test_lib/test_injector.ts b/modules/angular2/src/test_lib/test_injector.ts index 14294e7428..5f3e94f14e 100644 --- a/modules/angular2/src/test_lib/test_injector.ts +++ b/modules/angular2/src/test_lib/test_injector.ts @@ -93,7 +93,7 @@ function _getAppBindings() { // The document is only available in browser environment try { - appDoc = DOM.createHtmlDocument(); + appDoc = DOM.defaultDoc(); } catch (e) { appDoc = null; } diff --git a/modules/angular2/test/forms/integration_spec.ts b/modules/angular2/test/forms/integration_spec.ts index 3851e26020..ddf1b5f9cf 100644 --- a/modules/angular2/test/forms/integration_spec.ts +++ b/modules/angular2/test/forms/integration_spec.ts @@ -736,11 +736,6 @@ export function main() { rootTC.componentInstance.form = form; rootTC.detectChanges(); - // In IE, the element needs to be appended to the real DOM, - // otherwise setting .selectionStart fails with "unspecified error" - var isIE = DOM.getUserAgent().indexOf("Trident") > -1; - if (isIE) DOM.appendChild(DOM.defaultDoc().body, rootTC.nativeElement); - var input = rootTC.query(By.css("input")).nativeElement; input.value = "aa"; input.selectionStart = 1; @@ -751,7 +746,6 @@ export function main() { // selection start has not changed because we did not reset the value expect(input.selectionStart).toEqual(1); - if (isIE) DOM.removeChild(DOM.defaultDoc().body, rootTC.nativeElement); }))); }); });