Fix AMD issues.

Issues solved:

- Add a unit test for AMD loading.

- Remove the first (unnecessary) IIFE which causes a loading problem when used in a full AMD environment. (because the global jQuery is not defined yet)

- Plugins that depend on libraries that are not AMD modules (haml and handlebars) should use global objects.