Skip to content

cjohansen/live-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Live search, a JavaScript TDD showcase

Read the article: msdn.microsoft.com/en-us/gg650426.aspx

The code itself is very crude - this is just the start of a plugin. Note that it does not do anything other than display a list of suggestions. No keyboard navigation, no ability to select suggestions, no nothing. This is only an example of how I use TDD to develop code - there is only so much you can show in a single article.

To actually take the code for a spin, concatenate the source files like so:

cat client/lib/jquery.js client/src/list_renderer.js\
      client/src/xhr_data_source.js client/src/live_search.js\
      client/src/live_search.jquery.js > server/public/live-search.min.js

Then run the server (you’ll need Node.js 0.4.8 or higher)

cd server
npm link
./run_server

Then visit localhost:8000/ and type something in the search box. Suggestions should show up.

I wish I could tell you that I took the time to TDD the server code as well, but unfortunately, it’s a complete mess, and I only hacked it together in order to show the demo with some results.

To run the tests:

cd client && java -jar path/to/JsTestDriver-1.2.2.jar --tests all

I recommend Jstdutil (cjohansen.no/en/javascript/jstdutil_a_ruby_wrapper_over_jstestdriver).

About

A simple live search jQuery plugin, developed to showcase TDD with JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published