The tests use a BDD-style syntax, based around “features” and CSS selectors:
feature "GitHub search", (context, browser, $) -> before (done) -> browser.visit 'https://github.com/search', done it "finds WebSpecter", (done) -> $('input[name=q]').fill 'webspecter' $(button: 'Search').click -> $(link: "jgonera / webspecter").present.should.be.true done() it "looks only for users when asked to", (done) -> $('input[name=q]').fill 'webspecter' $(field: 'Search for').select 'Users' $(button: 'Search').click -> $(link: "jgonera / webspecter").present.should.be.false done()
browser object is a wrapper around Phantom’s
$ function is also present which is jQuery-like but not implemented using jQuery.
cerebral.js (GitHub: gorillatron / cerebral) by Andre Tangen extends Backbone.js to provide a module system and a publish/subscribe application core. It uses RequireJS for modules and module loading, and modules are restricted to a “sandbox” designed to limit the elements the module has access to.
The main motivation behind cerebral.js is to encourage loosely coupled applications. When I’m working on my own Backbone.js applications I usually adopt a similar approach, so it’s reassuring to see the same ideas in a framework.
The Mobify.js authors have also been building MIT-licensed Mobify.js modules, at the moment there’s a carousel and an accordion.