Programming

Unit testing a jQuery plugin with QUnit

QUnit is a powerful, yet easy-to-use JavaScript unit testing framework. It is used by the jQuery, jQuery UI and jQuery Mobile projects and it is well suited for testing a typical jQuery plugin. This article builts upon Getting Started with QUnit, How to Test Asynchronous Code with QUnit and of course the official Introduction to Unit Testing articles so feel free to skim through those first and return to see how QUnit can be used to test an already built jQuery plugin, and get you started with unit testing.
Continue reading…

Programming

Quick tip: careful with the ifChanged event of iCheck

iCheck is probably the best jQuery plugin for styling (or skinning) radio and checkbox inputs. However, there is a difference between the default change event of radio buttons and the ifChanged event of iCheck: the default change event fires when one of the radio buttons of the same named group is selected. At the same time, another radio is unchecked without firing a change event. On the other hand, the ifChanged of iCheck fires for both the just selected radio and the one that was previously selected. So, if you need to call a function using iCheck events, it is better to listen for change and ifClicked events. Just saying!

Continue reading…