Created
August 17, 2012 18:36
-
-
Save mikegrassotti/3381427 to your computer and use it in GitHub Desktop.
CasperJS (or PhantomJS) don't show modal content when using .fade
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bootstrap, from Twitter</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css" rel="stylesheet"> | |
</head> | |
<body> | |
<p> | |
<a class="btn btn-primary btn-large" id="hide">Hide</a> | |
<a class="btn btn-primary btn-large" id="fade">Fade</a> | |
</p> | |
<div class="modal hide" id="hideModal"> | |
<div class="modal-header"> | |
<h3>Modal header</h3> | |
</div> | |
<div class="modal-body"> | |
<p>Hide modal</p> | |
</div> | |
<div class="modal-footer"> | |
<a href="#" class="btn" data-dismiss="modal">Close hide</a> | |
</div> | |
</div> | |
<div class="modal fade" id="fadeModal"> | |
<div class="modal-header"> | |
<h3>Modal header</h3> | |
</div> | |
<div class="modal-body"> | |
<p>Fade modal</p> | |
</div> | |
<div class="modal-footer"> | |
<a href="#" class="btn" data-dismiss="modal">Close fade</a> | |
</div> | |
</div> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/js/bootstrap.min.js"></script> | |
<script type="text/javascript"> | |
$('#hide').on('click', function (e) { | |
$('#hideModal').modal('show'); | |
}); | |
$('#fade').on('click', function (e) { | |
$('#fadeModal').modal('show'); | |
}); | |
</script> | |
</script> | |
</body> | |
</html> |
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
casper = require('casper').create() | |
casper.start 'http://127.0.0.1:6001', -> | |
@viewport 1024, 768 | |
casper.then -> | |
@clickLabel 'Fade', 'a' | |
@test.assertTextExists 'Fade modal' | |
@capture 'fade.png' | |
@clickLabel 'Close fade', 'a' | |
casper.then -> | |
@clickLabel 'Hide', 'a' | |
@test.assertTextExists 'Hide modal' | |
@capture 'hide.png' | |
@clickLabel 'Close hide', 'a' | |
casper.run -> | |
@test.renderResults true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment