Created
October 2, 2012 08:56
-
-
Save mvasilkov/3817523 to your computer and use it in GitHub Desktop.
QUnit test with RequireJS (partial)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['events'], function(events) { | |
module('events.js') | |
test('Basic methods', function() { | |
// `register` and `bind` | |
var str = 'Life is beautiful' | |
events.register('str_replace') | |
events.bind('str_replace', function() { str = str.replace('Life', 'Flower') }) | |
events.fire('str_replace') | |
strictEqual(str, 'Flower is beautiful', 'Can register and fire events (`bind`)') | |
events.register('str_set') | |
events.bind('str_set', function(arg) { str = arg }) | |
events.fire('str_set', 'PAINT IT RED') | |
strictEqual(str, 'PAINT IT RED', 'Can register and fire parameterized events (`bind`)') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment