From 1c9be9b5aabcf27a45f1528c7e47d028eff0a85e Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Wed, 19 Aug 2015 16:47:18 +0200 Subject: [PATCH] chore(build): add Firefox to CI --- modules/angular2/src/test_lib/utils.ts | 5 +++++ modules/angular2/test/forms/integration_spec.ts | 10 +++++++++- sauce.conf.js | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/angular2/src/test_lib/utils.ts b/modules/angular2/src/test_lib/utils.ts index 76a4cf6c9c..d7af221771 100644 --- a/modules/angular2/src/test_lib/utils.ts +++ b/modules/angular2/src/test_lib/utils.ts @@ -92,3 +92,8 @@ export function stringifyElement(el): string { export function supportsIntlApi(): boolean { return DOM.getUserAgent().indexOf('Chrome') > -1 && DOM.getUserAgent().indexOf('Edge') == -1; } + +// TODO(mlaval): extract all browser detection checks from all tests +export function isFirefox(): boolean { + return DOM.getUserAgent().indexOf("Firefox") > -1; +} diff --git a/modules/angular2/test/forms/integration_spec.ts b/modules/angular2/test/forms/integration_spec.ts index 15b254a7fb..0f13fc2e80 100644 --- a/modules/angular2/test/forms/integration_spec.ts +++ b/modules/angular2/test/forms/integration_spec.ts @@ -14,7 +14,8 @@ import { it, inject, iit, - xit + xit, + isFirefox } from 'angular2/test_lib'; import {DOM} from 'angular2/src/dom/dom_adapter'; @@ -737,6 +738,13 @@ export function main() { rootTC.componentInstance.form = form; rootTC.detectChanges(); + // In Firefox, effective text selection in the real DOM requires an actual focus + // of the field. This is not an issue in a new HTML document. + if (isFirefox()) { + var fakeDoc = DOM.createHtmlDocument(); + DOM.appendChild(fakeDoc.body, rootTC.nativeElement); + } + var input = rootTC.query(By.css("input")).nativeElement; input.value = "aa"; input.selectionStart = 1; diff --git a/sauce.conf.js b/sauce.conf.js index 5535da6d18..7d7203d911 100644 --- a/sauce.conf.js +++ b/sauce.conf.js @@ -125,7 +125,7 @@ var aliases = { 'SAFARI': ['SL_SAFARI7', 'SL_SAFARI8'], 'BETA': ['SL_CHROMEBETA', 'SL_FIREFOXBETA'], 'DEV': ['SL_CHROMEDEV', 'SL_FIREFOXDEV'], - 'CI': ['SL_CHROME', 'SL_ANDROID5.1', 'SL_SAFARI8', 'SL_IOS8'] + 'CI': ['SL_CHROME', 'SL_ANDROID5.1', 'SL_SAFARI8', 'SL_IOS8', 'SL_FIREFOX'] }; module.exports = {