Testing Teaspoon: Expected true to equal false

家住魔仙堡 提交于 2019-12-11 04:20:53

问题


modal.hide() is not closing the modal in tests, but works in manual testing. When I check if I can see the modal variable, I can see it from the 'it' statement, so I am not sure why I get a true when it should be false.

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);
      });
    });
  })
});

来源:https://stackoverflow.com/questions/56436437/testing-teaspoon-expected-true-to-equal-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!