repo for angularjs testing training
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
522 B

describe('debounced test', function(){
beforeEach(function(){
jasmine.clock().install();
});
afterEach(function(){
jasmine.clock().uninstall();
});
it('should call the method only after the 500ms debounce', function(){
function debouncedMethod() {
// do something async;
}
function evaluateResults() {
// check results of async function
}
debouncedMethod();
jasmine.clock().tick(501); //increment clock 501 ms.
evaluateResults();
//assertions follow
});
});