Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow empty keyframe and keyframes with non-animatable properties.
We need to create CSS animations that have empty keyframe or keyframes which have only invalid properties or non-animatable properties to fire animation events for such animations.
- Loading branch information
Hiroyuki Ikezoe
committed
Jan 31, 2017
1 parent
8421ae6
commit a80725c
Showing
4 changed files
with
67 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
use parking_lot::RwLock; | ||
use std::sync::Arc; | ||
use style::keyframes::{Keyframe, KeyframesAnimation, KeyframePercentage, KeyframeSelector}; | ||
use style::properties::PropertyDeclarationBlock; | ||
|
||
#[test] | ||
fn test_empty_keyframe() { | ||
let keyframes = vec![]; | ||
let animation = KeyframesAnimation::from_keyframes(&keyframes); | ||
let expected = KeyframesAnimation { | ||
steps: vec![], | ||
properties_changed: vec![], | ||
}; | ||
|
||
assert_eq!(format!("{:#?}", animation), format!("{:#?}", expected)); | ||
} | ||
|
||
#[test] | ||
fn test_no_property_in_keyframe() { | ||
let keyframes = vec![ | ||
Arc::new(RwLock::new(Keyframe { | ||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(1.)]), | ||
block: Arc::new(RwLock::new(PropertyDeclarationBlock { | ||
declarations: vec![], | ||
important_count: 0, | ||
})) | ||
})), | ||
]; | ||
let animation = KeyframesAnimation::from_keyframes(&keyframes); | ||
let expected = KeyframesAnimation { | ||
steps: vec![], | ||
properties_changed: vec![], | ||
}; | ||
|
||
assert_eq!(format!("{:#?}", animation), format!("{:#?}", expected)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters