|
5 | 5 | * Use of this source code is governed by an MIT-style license that can be |
6 | 6 | * found in the LICENSE file at https://angular.io/license |
7 | 7 | */ |
8 | | -import {ElementAnimationStyleHandler} from '../../../src/render/css_keyframes/element_animation_style_handler'; |
| 8 | +import {ElementAnimationStyleHandler, getAnimationStyle} from '../../../src/render/css_keyframes/element_animation_style_handler'; |
9 | 9 | import {computeStyle} from '../../../src/util'; |
10 | | - |
11 | 10 | import {assertStyle, createElement, makeAnimationEvent, supportsAnimationEventCreation} from './shared'; |
12 | 11 |
|
13 | 12 | const EMPTY_FN = () => {}; |
@@ -227,5 +226,23 @@ const EMPTY_FN = () => {}; |
227 | 226 | element.dispatchEvent(event); |
228 | 227 | expect(done).toBeTruthy(); |
229 | 228 | }); |
| 229 | + |
| 230 | + // Issue: https://github.com/angular/angular/issues/24094 |
| 231 | + it('should not break getAnimationStyle in old browsers', () => { |
| 232 | + // Old browsers like Chrome Android 34 returns null if element.style |
| 233 | + // is not found, modern browsers returns empty string. |
| 234 | + const fakeElement = { |
| 235 | + style: { |
| 236 | + 'animationstyle1': 'value', |
| 237 | + 'animationstyle2': null, |
| 238 | + 'animationstyle3': '', |
| 239 | + 'animation': null |
| 240 | + } |
| 241 | + }; |
| 242 | + expect(getAnimationStyle(fakeElement, 'style1')).toBe('value'); |
| 243 | + expect(getAnimationStyle(fakeElement, 'style2')).toBe(''); |
| 244 | + expect(getAnimationStyle(fakeElement, 'style3')).toBe(''); |
| 245 | + expect(getAnimationStyle(fakeElement, '')).toBe(''); |
| 246 | + }); |
230 | 247 | }); |
231 | 248 | } |
0 commit comments