YUI 2.5.0: YUI Test reaches GA and more
In case you missed the official announcement, today YUI 2.5.0 was released. With this release, YUI Test has been promoted out of the beta stage into general availability (GA). I’m really excited about this as YUI Test was my first contribution to YUI and I honestly believe it’s probably one of the most useful pieces of code I’ve ever written.
First, YUI Test can be used to test
any code. Your code doesn’t need to be built on YUI at all to use YUI Test. I’ve used it for my own personal experiments (that’s actually what led to its creation) and others have as well. If you have code using another library, or no library at all, you can still use YUI Test to ensure it works correctly.
Second, YUI Test includes a full event-simulation utility. You can simulate all basic mouse and keyboard events using the
YAHOO.util.UserAction object. This means that you can trigger your event handlers programmatically, all by writing some simple code. The result is the ability to unit test widgets and visual elements in pages, which YUI does. Event simulation works in all A-grade browsers, including Internet Explorer 6+, Firefox 1.5+, and Safari 2.x+ (though there is an issue with simulating the
keydown event that causes Safari 2.x to crash; this is fixed in Safari 3.x).
My latest addition to YUI, new to 2.5.0, is the Cookie utility, a very simple API for reading and writing cookies and subcookies. Not very sexy, but useful if you’re dealing with cookies.
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.