•  

Plugin Unit Testing - Get around the event loop

A session at jQuery Conference: SF 2012

Friday 29th June, 2012

3:00pm to 3:35pm (PST)

For many front end developers, including me, a jQuery plugin was their first repository on GitHub. Reading that code again, I found many bugs and I am very grateful that no one ever used it in production. At the time, I was completely confident about my code working as I intended it to, but I never stopped to think twice about why I felt that way. Since then, the most significant tool that I have picked up is unit testing and the biggest hindrance in learning how to unit test has consistently been the event loop. For example, how do I ensure that particular code paths are followed when an element is clicked, double clicked, or if the window has scrolled into a particular state.

Most unit testing examples focus on very straightforward imperative tests. I have seen many explanations of JavaScript unit testing that describe how to verify the logic behind a calculator or a form validation library, but not how to test a more complex, event-triggered interaction. In this talk, I will address how to begin unit testing jQuery plugins, and how to avoid common pitfalls when dealing with asynchronous, or event handling code. Most importantly, I will explain how to deal with verifying that code is executed when native browser events fire.

About the speaker

This person is speaking at this event.
John K. Paul

I'm a front end software engineer with many more interests than that. bio from Twitter

Coverage of this session

Sign in to add slides, notes or videos to this session

Tell your friends!

When

Time 3:00pm3:35pm PST

Date Fri 29th June 2012

Short URL

lanyrd.com/swmft

Official event site

events.jquery.org/2012/sf/

View the schedule

Share

Topics

See something wrong?

Report an issue with this session