refactor: remove some facades (#12335)

This commit is contained in:
Victor Berchet
2016-10-19 13:42:39 -07:00
committed by Alex Rickabaugh
parent 0ecd9b2df0
commit 76dd026447
58 changed files with 281 additions and 429 deletions

View File

@ -9,7 +9,7 @@
import {NgZone} from '@angular/core';
import {ListWrapper} from './facade/collection';
import {global, isPresent, isString} from './facade/lang';
import {global, isPresent} from './facade/lang';
import {getDOM} from './private_import_platform-browser';
export class BrowserDetection {
@ -108,7 +108,7 @@ export function stringifyElement(el: any /** TODO #9100 */): string {
for (let i = 0; i < keys.length; i++) {
var key = keys[i];
var attValue = attributeMap.get(key);
if (!isString(attValue)) {
if (typeof attValue !== 'string') {
result += ` ${key}`;
} else {
result += ` ${key}="${attValue}"`;

View File

@ -7,7 +7,7 @@
*/
import {global, isString} from './facade/lang';
import {global} from './facade/lang';
import {getDOM} from './private_import_platform-browser';
@ -187,7 +187,7 @@ _global.beforeEach(function() {
return {
compare: function(actual: any, styles: {[k: string]: string}|string) {
let allPassed: boolean;
if (isString(styles)) {
if (typeof styles === 'string') {
allPassed = getDOM().hasStyle(actual, styles);
} else {
allPassed = Object.keys(styles).length !== 0;
@ -199,9 +199,9 @@ _global.beforeEach(function() {
return {
pass: allPassed,
get message() {
const expectedValueStr = isString(styles) ? styles : JSON.stringify(styles);
const expectedValueStr = typeof styles === 'string' ? styles : JSON.stringify(styles);
return `Expected ${actual.outerHTML} ${!allPassed ? ' ' : 'not '}to contain the
CSS ${isString(styles) ? 'property' : 'styles'} "${expectedValueStr}"`;
CSS ${typeof styles === 'string' ? 'property' : 'styles'} "${expectedValueStr}"`;
}
};
}