-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Reland #2 "Implement CSSTransitionDiscrete which enab…
- Loading branch information
1 parent
d9ee5ef
commit 9e6aeb0
Showing
4 changed files
with
86 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/4441"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id=target1 class=target>hello</div> | ||
<div id=target2 class=target>hello</div> | ||
|
||
<style> | ||
.target { | ||
float: left; | ||
width: 100px; | ||
height: 100px; | ||
} | ||
.target.animated { | ||
float: right; | ||
} | ||
|
||
#target1 { | ||
transition: all 1s, float 1s; | ||
} | ||
|
||
#target2 { | ||
transition: all 1s; | ||
} | ||
</style> | ||
|
||
<script> | ||
promise_test(async () => { | ||
let transitionstartFired = false; | ||
target1.addEventListener('transitionstart', () => { | ||
transitionstartFired = true; | ||
}); | ||
await new Promise(resolve => requestAnimationFrame(resolve)); | ||
target1.classList.add('animated'); | ||
await new Promise(resolve => requestAnimationFrame(resolve)); | ||
assert_true(transitionstartFired); | ||
}, 'all with an explicit discrete property should animate.'); | ||
|
||
promise_test(async () => { | ||
let transitionstartFired = false; | ||
target2.addEventListener('transitionstart', () => { | ||
transitionstartFired = true; | ||
}); | ||
await new Promise(resolve => requestAnimationFrame(resolve)); | ||
target2.classList.add('animated'); | ||
await new Promise(resolve => requestAnimationFrame(resolve)); | ||
assert_false(transitionstartFired); | ||
}, 'all without an explicit discrete property should not animate.'); | ||
</script> |
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,28 @@ | ||
<!DOCTYPE html> | ||
<link rel=help href="mailto:[email protected]"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<div id=target>target</div> | ||
<style> | ||
#target { | ||
display: none; | ||
transition: 1s; | ||
color: red; | ||
} | ||
#target.animated { | ||
transition: 1s; | ||
color: green; | ||
} | ||
</style> | ||
|
||
<script> | ||
test(() => { | ||
target.addEventListener('transitionstart', () => { | ||
assert_unreached('transitionstart should not be fired.'); | ||
}); | ||
target.classList.add('animated'); | ||
assert_equals(target.getAnimations().length, 0, | ||
'There should not be any animations running.'); | ||
}, 'Transitions and animations should not occur on display:none elements.'); | ||
</script> |
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