Module names and test names prevent QUnit operating
Hi, I've just started working with QUnit this morning and I'm getting some unexplainable behaviour. Calling a module anything other than "QUnit Test" and a test anything other than "Sample test" will prevent the tests from running at all. This works (in Safari 4 and Firefox 3.6): var domReady = function(f) {document.addEventListener("DOMContentLoaded", f, false);}; domReady(function(){ module("QUnit Test"); test("Sample test", function() { expect(1);
Simulating keypress events?
I know that I can use jQueryObj.trigger('keypress') to simulate a key press event, but how can I populate the keypress event attributes? I am testing an autocomplete plugin which of course requires simulating keystrokes.
Can you use QUnit to test event triggering?
Hi, I'm new to QUnit and I'm doing a quick look through whether QUnit is the right unit testing API for me. I want something to test JavaScript code by triggering an event, i.e. a mouse click or a key stroke. Can somebody be kind enough to let me know if this is possible via QUnit? I've tried to follow the jQuery QUnit documentation, but there are a lot of broken links and I'm lost. If possible please let me know where can I read more about it. Many thanks. Warmest Regards, Alexander
Async setup and teardown
Guys, I've had to run some async code on my setup and teardown methods but it was not working properly. Here's a simple patch to make it run and the corresponding test cases: http://github.com/fgrehm/qunit/compare/2dbf6037778266fa01a1...master What do you guys think, is this really needed? Cheers, Fábio Rehm
How can I fix the date used by the jQuery datepicker?
I'm using a testing stack including cucumber, capybara, and selenium webdriver. On of the scenarios is date sensitive and fails if it is run on the first day of a month which is at least as long as the preceding month. On the server side, I'd just use something like the Ruby timecop plugin to make Date.today return a fixed date for the duration of the test, but in this case it's the jQuery datepicker plugin picking the date and it's just using new Date. I'm open to suggestions about how to stub things
Load qunit asyncronously
Hi guys, I am trying to integrate qUnit in my web application from javascript, when I enable qunit every files and HTML needed are added dynamically, However it seems qunit use window.load, and it does not currently load what is inside, I tried to recall qunit using QUnit.init() but it always says 0 test cases when In fact there are severals loaded.. Any ideas?
Testing Submit Event
Hi, I'm very new to jquery and have just started looking at qunit for testing and I have a bit of existing code that I would like to add a test to but I can't figure out how to write the test from the qunit examples. Can someone help, below is the code I would like to write a test for: $(document).ready(function(){ $("#ajax-contact-form").submit(function(){ var str = $(this).serialize(); $.ajax({ type: "POST", url: "sendmail.php", data: str, success: function(msg){
How to test two or more asynchronous calls in a function?
Hi, I am doing jquery Qunit testing in my application, i use only asynchronous ajax calls. In a function i use 2 ajax calls. To test the async calls i use start() and stop(). In the callback of every async call i use start() and in test case after function is called, i use stop(). Original method: ============ function MyOriginalMethod() { Ajax_Async('/Home/Index', null, 'GET', false, MyCallBack1); Ajax_Async('/Home/MyAction', 'myName=ramesh', 'GET', false, MyCallBack2); } var MyCallBack1 =(function(){