O'Reilly logo

Instant typeahead.js by Toby Osbourn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the typeahead.js code (Become an expert)

One of the nice things about using typeahead.js is that it is so well tested. Not only does this mean you can be confident that things should work well out of the box (although not too confident, see our previous recipe!), but it also means that when you come to test your own code, you should only really be testing things unique to your business logic, not the underlying typeahead.js functionality.

Getting ready

We are going to be revisiting the recipe Manipulating Data (Become an expert), which walked us through how we could add new elements into our dataset. We wrote some code which we have seen works, but we didn't write tests for it, which wasn't very professional of us!

Let's load up the recipe ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required