From 43c71ae1032234ffeb31695c0e74f33834904ffd Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Fri, 29 Jul 2016 19:05:12 +0200 Subject: [PATCH] fix(platform-browser): IEMobile is badly detected when testing (#10382) --- .../platform-browser/test/browser_util_spec.ts | 12 ++++++++++++ .../platform-browser/testing/browser_util.ts | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/@angular/platform-browser/test/browser_util_spec.ts b/modules/@angular/platform-browser/test/browser_util_spec.ts index 24baf3197b..f175326b8b 100644 --- a/modules/@angular/platform-browser/test/browser_util_spec.ts +++ b/modules/@angular/platform-browser/test/browser_util_spec.ts @@ -85,6 +85,18 @@ export function main() { isSlow: true, isChromeDesktop: false }, + { + name: 'IEMobile', + ua: 'Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 520) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537', + isFirefox: false, + isAndroid: false, + isEdge: false, + isIE: true, + isWebkit: false, + isIOS7: false, + isSlow: true, + isChromeDesktop: false + }, { name: 'Edge', ua: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136', diff --git a/modules/@angular/platform-browser/testing/browser_util.ts b/modules/@angular/platform-browser/testing/browser_util.ts index e8379975e2..b52ae225db 100644 --- a/modules/@angular/platform-browser/testing/browser_util.ts +++ b/modules/@angular/platform-browser/testing/browser_util.ts @@ -28,7 +28,8 @@ export class BrowserDetection { get isAndroid(): boolean { return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 && - this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1; + this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1 && + this._ua.indexOf('IEMobile') == -1; } get isEdge(): boolean { return this._ua.indexOf('Edge') > -1; } @@ -36,11 +37,13 @@ export class BrowserDetection { get isIE(): boolean { return this._ua.indexOf('Trident') > -1; } get isWebkit(): boolean { - return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1; + return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1 && + this._ua.indexOf('IEMobile') == -1; } get isIOS7(): boolean { - return this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1; + return (this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1) && + this._ua.indexOf('IEMobile') == -1; } get isSlow(): boolean { return this.isAndroid || this.isIE || this.isIOS7; }