1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Add test for disabling of animations on pseudo elements

This commit is contained in:
Thomas Walpole 2019-06-19 16:04:43 -07:00
parent f1cb0ee9dc
commit b0f88ec75f
2 changed files with 36 additions and 2 deletions

View file

@ -6,6 +6,17 @@
<script src="/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
<script src="/test.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).on('transitionend', function(){
$(document.body).append('<div>Transition Ended</div>')
});
$(document).on('animationend', function(){
$(document.body).append('<div>Animation Ended</div>')
});
$(document).on('contextmenu', function(e){
e.preventDefault();
});
</script>
<style>
.transition.away {
width: 0%;
@ -17,6 +28,13 @@
overflow: hidden;
}
a::after {
content: "";
width: 0px;
height: 0px;
background-color: blue;
}
a:not(.away) {
height: 20px;
}
@ -35,12 +53,22 @@
animation-duration: 3s;
animation-fill-mode: forwards;
}
@keyframes pseudo_grow {
100% { height: 100px, width: 100px };
}
a.animation.pseudo::after {
animation: pseudo_grow 3s forwards;
}
</style>
</head>
<body id="with_animation">
<a href='#' class='transition' onclick='this.classList.add("away")'>transition me away</a>
<a href='#' class='animation' onclick='this.classList.add("away")'>animate me away</a>
<a href='#' class='animation' onclick='this.classList.add("away")' oncontextmenu='this.classList.add("pseudo")'>
animate me away
</a>
</body>
</html>

View file

@ -355,11 +355,17 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
expect(@animation_session).to have_no_link('transition me away', wait: 0.5)
end
it 'should disable CSS animations' do
it 'should disable CSS animations (set to 0s)' do
@animation_session.visit('with_animation')
@animation_session.click_link('animate me away')
expect(@animation_session).to have_no_link('animate me away', wait: 0.5)
end
it 'should disable CSS animations on pseudo elements (set to 0s)' do
@animation_session.visit('with_animation')
@animation_session.find_link('animate me away').right_click
expect(@animation_session).to have_content('Animation Ended', wait: 0.1)
end
end
context 'if we pass in css that matches elements' do