velesin / jasmine-jquery

jQuery matchers and fixture loader for Jasmine framework
MIT License
1.89k stars 346 forks source link

Jasmine DOM testing #207

Open KiruthikaKumar opened 10 years ago

KiruthikaKumar commented 10 years ago

Hi All, I am facing issues in writing test cases for DOM elements using Jasmine.

My Function is:

function sample (event){ $('#select').dropkick('reload'); }

Please provide me steps to test the above function using jasmine-jquery.js Thanks in prior.

mrjoelkemp commented 10 years ago

Hey @KiruthikaKumar. Do you know what you'd specifically like to test about this function? What do you expect to happen after calling dropkick('reload')?

KiruthikaKumar commented 10 years ago

Hi @mrjoelkemp I need to check whether dropkick reload is called or not

mrjoelkemp commented 10 years ago

You can spy on the dropkick function, make sure that the spy was called, and then check that it was called with the 'reload' argument. This is a regular jasmine test though, not a jasmine-jquery test.

If you're talking about asserting that the DOM changed due to dropkick reload being called, then that's better. If this is the case, do you have any sample code showcasing your ideas? On Aug 21, 2014 12:01 AM, "KiruthikaKumar" notifications@github.com wrote:

Hi @mrjoelkemp https://github.com/mrjoelkemp I need to check whether dropkick reload is called or not

— Reply to this email directly or view it on GitHub https://github.com/velesin/jasmine-jquery/issues/207#issuecomment-52876129 .