如何使用 Jasmine 或其他工具来测试嵌入在网页中的 JavaScript / JQuery,如下例所示?
<html>
<head>
<!-- usual includes -->
</head>
<body>
<span id="myspan1"></span>
<span id="myspan2"></span>
<script type="text/javascript">
$(document).ready(function(){
$('#myspan1').html('something');
$('#myspan1').click(function(){
$('#myspan1').html('something else');
});
doStuff();
function doStuff() {
$('#myspan2').html('stuff done');
}
});
</script>
</body>
</html>