javascript - Jasmine jQuery: Check if element is visible -
hello got question regarding unit testing jasmine (plugin: jquery)
how test if object within dom of document. thing use tooltip function activated when event simulated. when there simulation of effect, object attached dom , want check if visible or not.
it("test 1: should invoke tooltip() function.", function () { spyevent = spyonevent('.span_width', "mouseover"); $('.span_width').simulate('mouseover'); expect('mouseover').tohavebeentriggeredon('.span_width'); expect(spyevent).tohavebeentriggered(); # test check if .tooltip visible??? # in jquery be: $('.tooltip').is(':visible'); });
you commented in jquery be: $('.tooltip').is(':visible');
yes would. in jasmine unit testing, passes test, you're expecting above true:
expect($('.tooltip').is(':visible')).tobe(true); // passes expect($('.tooltip').is(':visible')).tobe(false); // fails
Comments
Post a Comment