Testing code that uses another framework than jQuery using QUnit?
I am writing a small library that can use several frameworks (jQuery, Prototype, YUI2 at the moment) as its backend and I am testing it using QUnit. However, QUnit requires jQuery.
Is there a way to run a test in a sandboxed environment which does not contain开发者_如何学编程 jQuery?
EDIT: I'd prefer a sandbox over just including everything because it would enable me to test several versions of the libraries at the same time.
This answer may be a bit late -- qunit now does not utilize jquery as it's base, so you should be able to run it independent of jquery. Good luck on your work!
I would include your additional libraries, then jQuery, then qUnit, then use $.noConflict()
to relinquish control of the $
variable back to the other libraries. At that point, you can write unit tests for your other libraries just like you would for jquery without worrying about conflicts. Since jQuery doesn't extend any core methods, you shouldn't have any issues.
Is http://jsfiddle.net/ something you would be looking for?
精彩评论