refactor(facade): Remove most of StringMapWrapper facade. (#12022)
This change mostly automated by
12012b07a2
with some manual fixes.
This commit is contained in:

committed by
Chuck Jazdzewski

parent
ed9c2b6281
commit
b64b5ece65
@ -7,8 +7,6 @@
|
||||
*/
|
||||
|
||||
import {AUTO_STYLE} from '@angular/core';
|
||||
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {StringWrapper, isNumber, isPresent} from '../facade/lang';
|
||||
import {AnimationKeyframe, AnimationStyles} from '../private_import_core';
|
||||
|
||||
@ -65,15 +63,16 @@ function _populateStyles(
|
||||
defaultStyles: {[key: string]: string | number}): {[key: string]: string | number} {
|
||||
var data: {[key: string]: string | number} = {};
|
||||
styles.styles.forEach((entry) => {
|
||||
StringMapWrapper.forEach(entry, (val: any, prop: string) => {
|
||||
Object.keys(entry).forEach(prop => {
|
||||
const val = entry[prop];
|
||||
var formattedProp = dashCaseToCamelCase(prop);
|
||||
data[formattedProp] =
|
||||
val == AUTO_STYLE ? val : val.toString() + _resolveStyleUnit(val, prop, formattedProp);
|
||||
});
|
||||
});
|
||||
StringMapWrapper.forEach(defaultStyles, (value: string, prop: string) => {
|
||||
Object.keys(defaultStyles).forEach(prop => {
|
||||
if (!isPresent(data[prop])) {
|
||||
data[prop] = value;
|
||||
data[prop] = defaultStyles[prop];
|
||||
}
|
||||
});
|
||||
return data;
|
||||
|
@ -7,8 +7,6 @@
|
||||
*/
|
||||
|
||||
import {AUTO_STYLE} from '@angular/core';
|
||||
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {AnimationPlayer} from '../private_import_core';
|
||||
|
||||
@ -49,7 +47,8 @@ export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
|
||||
var keyframes = this.keyframes.map(styles => {
|
||||
var formattedKeyframe: {[key: string]: string | number} = {};
|
||||
StringMapWrapper.forEach(styles, (value: string | number, prop: string) => {
|
||||
Object.keys(styles).forEach(prop => {
|
||||
const value = styles[prop];
|
||||
formattedKeyframe[prop] = value == AUTO_STYLE ? _computeStyle(this.element, prop) : value;
|
||||
});
|
||||
return formattedKeyframe;
|
||||
|
@ -12,7 +12,6 @@ import {el} from '@angular/platform-browser/testing/browser_util';
|
||||
import {DomAnimatePlayer} from '../../src/dom/dom_animate_player';
|
||||
import {WebAnimationsDriver} from '../../src/dom/web_animations_driver';
|
||||
import {WebAnimationsPlayer} from '../../src/dom/web_animations_player';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {AnimationKeyframe, AnimationStyles} from '../../src/private_import_core';
|
||||
import {MockDomAnimatePlayer} from '../../testing/mock_dom_animate_player';
|
||||
|
||||
@ -113,7 +112,7 @@ export function main() {
|
||||
var player = driver.animate(elm, startingStyles, styles, 1000, 1000, null);
|
||||
var details = _formatOptions(player);
|
||||
var options = details['options'];
|
||||
var keys = StringMapWrapper.keys(options);
|
||||
var keys = Object.keys(options);
|
||||
expect(keys.indexOf('easing')).toEqual(-1);
|
||||
});
|
||||
});
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {StringMapWrapper} from './facade/collection';
|
||||
|
||||
import {global, isString} from './facade/lang';
|
||||
import {getDOM} from './private_import_platform-browser';
|
||||
|
||||
@ -190,9 +190,9 @@ _global.beforeEach(function() {
|
||||
if (isString(styles)) {
|
||||
allPassed = getDOM().hasStyle(actual, styles);
|
||||
} else {
|
||||
allPassed = !StringMapWrapper.isEmpty(styles);
|
||||
StringMapWrapper.forEach(styles, (style: string, prop: string) => {
|
||||
allPassed = allPassed && getDOM().hasStyle(actual, prop, style);
|
||||
allPassed = Object.keys(styles).length !== 0;
|
||||
Object.keys(styles).forEach(prop => {
|
||||
allPassed = allPassed && getDOM().hasStyle(actual, prop, styles[prop]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,6 @@
|
||||
import {AnimationPlayer} from '@angular/core';
|
||||
import {MockAnimationPlayer} from '@angular/core/testing/testing_internal';
|
||||
import {AnimationDriver} from '@angular/platform-browser';
|
||||
|
||||
import {StringMapWrapper} from './facade/collection';
|
||||
import {AnimationKeyframe, AnimationStyles} from './private_import_core';
|
||||
|
||||
export class MockAnimationDriver extends AnimationDriver {
|
||||
@ -40,7 +38,7 @@ function _serializeKeyframes(keyframes: AnimationKeyframe[]): any[] {
|
||||
function _serializeStyles(styles: AnimationStyles): {[key: string]: any} {
|
||||
var flatStyles: {[key: string]: any} = {};
|
||||
styles.styles.forEach((entry: {[key: string]: string | number;}) => {
|
||||
StringMapWrapper.forEach(entry, (val: any, prop: string) => { flatStyles[prop] = val; });
|
||||
Object.keys(entry).forEach(prop => { flatStyles[prop] = entry[prop]; });
|
||||
});
|
||||
return flatStyles;
|
||||
}
|
||||
|
Reference in New Issue
Block a user