fix(BrowserUtil): fix `supportsIntlApi()`

This commit is contained in:
Victor Berchet 2016-06-17 15:34:12 -07:00
parent 49bf3f5b3a
commit 76a418760e
2 changed files with 2 additions and 18 deletions

View File

@ -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'));
});
});

View File

@ -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 !!(<any>global).Intl;
}
get isChromeDesktop(): boolean {