Jquery 测试茶匙:预期为真等于假
modal.hide()不是在测试中关闭模态,而是在手动测试中工作。当我检查是否可以看到模态变量时,我可以从'it'语句中看到它,所以我不确定为什么当它应该为false时我会得到trueJquery 测试茶匙:预期为真等于假,jquery,twitter-bootstrap,teaspoon,Jquery,Twitter Bootstrap,Teaspoon,modal.hide()不是在测试中关闭模态,而是在手动测试中工作。当我检查是否可以看到模态变量时,我可以从'it'语句中看到它,所以我不确定为什么当它应该为false时我会得到true describe("Helpers.Bootstrap.Modal", function() { describe("show", function(){ var modal ; describe("When no element Id is assigned to Modal()", f
describe("Helpers.Bootstrap.Modal", function() {
describe("show", function(){
var modal ;
describe("When no element Id is assigned to Modal()", function(){
beforeAll(function(){
modal = new Helpers.Bootstrap.Modal();
modal.show('Title','Message','ok','close', null);
})
it("constructor should return default Id", function(){
expect(modal.element).toEqual("#AlertModal");
expect(modal.elementname).toEqual("AlertModal");
});
it("hide() should close the modal", function(){
modal.hide();
var modal_hide = ($(modal.element).data('bs.modal') || {isShown: false})._isShown;
expect(modal_hide).toEqual(false);
});
});
})
});