diff options
| author | Misko Hevery | 2010-01-25 20:02:24 -0800 |
|---|---|---|
| committer | Misko Hevery | 2010-01-25 20:02:24 -0800 |
| commit | 0b630972b15676b1c1b6c59edd564e4ee331ec70 (patch) | |
| tree | bd31ca5b69b6ea03d906a3107dfe38a8c1adcb8e /test/AngularTest.js | |
| parent | 19bbee030ba012b8fc4835c1d17e039804b2b94b (diff) | |
| parent | 473e57e22532f9b85fc9dcc1bcc53e12a10154c2 (diff) | |
| download | angular.js-0b630972b15676b1c1b6c59edd564e4ee331ec70.tar.bz2 | |
merge
Diffstat (limited to 'test/AngularTest.js')
| -rw-r--r-- | test/AngularTest.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/AngularTest.js b/test/AngularTest.js new file mode 100644 index 00000000..a9146adf --- /dev/null +++ b/test/AngularTest.js @@ -0,0 +1,45 @@ +AngularTest = TestCase('AngularTest'); + + +UrlWatcherTest = TestCase('UrlWatcherTest'); + +UrlWatcherTest.prototype.testUrlWatcher = function () { + expectAsserts(2); + var location = {href:"http://server", hash:""}; + var watcher = new UrlWatcher(location); + watcher.delay = 1; + watcher.listener = function(url){ + assertEquals('http://getangular.test', url); + }; + watcher.setTimeout = function(fn, delay){ + assertEquals(1, delay); + location.href = "http://getangular.test"; + watcher.setTimeout = function(fn, delay) { + }; + fn(); + }; + watcher.watch(); +}; + +UrlWatcherTest.prototype.testItShouldFireOnUpdateEventWhenSpecialURLSet = function(){ + expectAsserts(2); + var location = {href:"http://server", hash:"#$iframe_notify=1234"}; + var watcher = new UrlWatcher(location); + angular.callbacks._iframe_notify_1234 = function () { + assertEquals("undefined", typeof angularCallbacks._iframe_notify_1234); + assertEquals("http://server2#", location.href); + }; + watcher.delay = 1; + watcher.expectedUrl = "http://server2"; + watcher.setTimeout = function(fn, delay){ + watcher.setTimeout = function(fn, delay) {}; + fn(); + }; + watcher.watch(); +}; + +FunctionTest = TestCase("FunctionTest"); + +FunctionTest.prototype.testEscapeHtml = function () { + assertEquals("<div>&amp;</div>", escapeHtml('<div>&</div>')); +};
\ No newline at end of file |
