私は次のジャスミンテストを持っています、
describe('test', function () {
beforeEach(function() {
loadFixtures('../../Fixtures.html');
});
it('should add some html', function () {
$("#some_btn").click();
expect($("#some_div")).toExist();
});
it('should do something with the div', function () {
//do something
expect($("#some_div")).toHaveClass("some_class");
});
});
クリックをトリガーすると関数が実行され、witchはhtmlページにdivを追加します。
function addDiv(){
$("#existing_div").append('<div id="some_div"></div>');
}
これはhtmlです、
...
<div id="some_btn" onclick="addDiv();"></div>
...
<div id="existing_div">
<!--where the div is supposed to be inserted-->
</div>
2番目のテストは失敗します。私はジャスミンに不慣れですこれは失敗すると思いますか?私は何かが足りないのですか?
ありがとう..
編集済み:コードを編集しましたが、間違ってコピーしましたが、テストの最後の部分がありませんでした。ごめん :(