unit testing - How to write jasmine test to check update -


i'm trying write jasmine test check view changing time or not

it 'ticks time', ->   @time = parseint($('#timer h1').text())   settimeout (->     @after = parseint($('#timer h1').text())     expect(@time).tobelessthan(@after)   ), 1000 

the problem when time of settimeout jasmine finished job, no html code on page related test @ moment.

jasmine has solutions kind of task:

it 'ticks time', ->   runs ->     @time = parseint($('#timer h1').text())   waits(1000)   runs ->     @after = parseint($('#timer h1').text())     expect(@time).tobegreaterthan(@after) 

Comments

Popular posts from this blog

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

What design pattern is this code in Javascript? -

javascript - Unusual behaviour when drawing lots of images onto a large canvas -