From 76a418760e5de24342e95b9cb7a090d19458b5f4 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Fri, 17 Jun 2016 15:34:12 -0700 Subject: [PATCH] fix(BrowserUtil): fix `supportsIntlApi()` --- .../platform-browser/test/browser_util_spec.ts | 16 ---------------- .../platform-browser/testing/browser_util.ts | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/modules/@angular/platform-browser/test/browser_util_spec.ts b/modules/@angular/platform-browser/test/browser_util_spec.ts index 5c444dd14b..c21ec4bae6 100644 --- a/modules/@angular/platform-browser/test/browser_util_spec.ts +++ b/modules/@angular/platform-browser/test/browser_util_spec.ts @@ -17,7 +17,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: false, - supportsIntlApi: true, isChromeDesktop: true }, { @@ -30,7 +29,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: false, - supportsIntlApi: true, isChromeDesktop: false }, { @@ -43,7 +41,6 @@ export function main() { isWebkit: false, isIOS7: false, isSlow: false, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -56,7 +53,6 @@ export function main() { isWebkit: false, isIOS7: false, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -69,7 +65,6 @@ export function main() { isWebkit: false, isIOS7: false, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -82,7 +77,6 @@ export function main() { isWebkit: false, isIOS7: false, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -95,7 +89,6 @@ export function main() { isWebkit: false, isIOS7: false, isSlow: false, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -108,7 +101,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -121,7 +113,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -134,7 +125,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -147,7 +137,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: false, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -160,7 +149,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: false, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -173,7 +161,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: false, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -186,7 +173,6 @@ export function main() { isWebkit: true, isIOS7: true, isSlow: true, - supportsIntlApi: false, isChromeDesktop: false }, { @@ -199,7 +185,6 @@ export function main() { isWebkit: true, isIOS7: false, isSlow: false, - supportsIntlApi: false, isChromeDesktop: false } ]; @@ -214,7 +199,6 @@ export function main() { expect(bd.isWebkit).toBe(StringMapWrapper.get(browser, 'isWebkit')); expect(bd.isIOS7).toBe(StringMapWrapper.get(browser, 'isIOS7')); expect(bd.isSlow).toBe(StringMapWrapper.get(browser, 'isSlow')); - expect(bd.supportsIntlApi).toBe(StringMapWrapper.get(browser, 'supportsIntlApi')); expect(bd.isChromeDesktop).toBe(StringMapWrapper.get(browser, 'isChromeDesktop')); }); }); diff --git a/modules/@angular/platform-browser/testing/browser_util.ts b/modules/@angular/platform-browser/testing/browser_util.ts index 2c8da39617..fdb53715b1 100644 --- a/modules/@angular/platform-browser/testing/browser_util.ts +++ b/modules/@angular/platform-browser/testing/browser_util.ts @@ -1,6 +1,6 @@ import {getDOM} from '../src/dom/dom_adapter'; import {ListWrapper} from '../src/facade/collection'; -import {RegExp, RegExpWrapper, StringWrapper, isPresent, isString} from '../src/facade/lang'; +import {RegExp, RegExpWrapper, StringWrapper, isPresent, isString, global} from '../src/facade/lang'; export class BrowserDetection { private _overrideUa: string; @@ -41,7 +41,7 @@ export class BrowserDetection { // Note: Edge is disguised as Chrome 42, so checking the "Edge" part is needed, // see https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx get supportsIntlApi(): boolean { - return this._ua.indexOf('Chrome/4') > -1 && this._ua.indexOf('Edge') == -1; + return !!(global).Intl; } get isChromeDesktop(): boolean {