mercredi 3 juin 2015

Is there any wait() function for AngularJS Jasmine test?

I created a popup, it will open on first click and will close on second click. However, I faced problem when do testing. The second click doesn't close the popup. And I found out that the problem is because during the first click the popup haven't appeared in the screen yet, that's why the second click doesn't close the popup. So, I decide to put a delay between the clicks. Any idea on how to implement the delay?

describe('Popup', function(){
            it("Should close on second click", function(){
                compileDirective(400,'click','true');  
                element.triggerHandler('click');
                waitttttttt(1000); // Wait function here before proceed to next line
                element.triggerHandler('click');
                scope.$digest();
                timeout.flush();
                expect($('.sidepopright').length).toBe(0);
                element.remove();
                $(".sidepopright").remove();
            });
      });

Aucun commentaire:

Enregistrer un commentaire