2010-01-18 18:47:03 +00:00
|
|
|
AngularTest = TestCase('AngularTest');
|
2010-01-06 00:36:58 +00:00
|
|
|
|
2010-01-18 18:47:03 +00:00
|
|
|
AngularTest.prototype.testDefaultDatabasePathFromSubdomain = function() {
|
|
|
|
|
var loader = new Angular(null, null, {server:"http://account.getangular.com", database:"database"});
|
2010-01-06 00:36:58 +00:00
|
|
|
loader.computeConfiguration();
|
|
|
|
|
assertEquals("database", loader.config.database);
|
|
|
|
|
|
2010-01-18 18:47:03 +00:00
|
|
|
loader = new Angular(null, null, {server:"http://account.getangular.com"});
|
2010-01-06 00:36:58 +00:00
|
|
|
loader.computeConfiguration();
|
|
|
|
|
assertEquals("account", loader.config.database);
|
|
|
|
|
|
2010-01-18 18:47:03 +00:00
|
|
|
loader = new Angular(null, null, {server:"https://account.getangular.com"});
|
2010-01-06 00:36:58 +00:00
|
|
|
loader.computeConfiguration();
|
|
|
|
|
assertEquals("account", loader.config.database);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UrlWatcherTest = TestCase('UrlWatcherTest');
|
|
|
|
|
|
|
|
|
|
UrlWatcherTest.prototype.testUrlWatcher = function () {
|
|
|
|
|
expectAsserts(2);
|
|
|
|
|
var location = {href:"http://server", hash:""};
|
2010-01-09 23:02:43 +00:00
|
|
|
var watcher = new UrlWatcher(location);
|
2010-01-06 00:36:58 +00:00
|
|
|
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"};
|
2010-01-09 23:02:43 +00:00
|
|
|
var watcher = new UrlWatcher(location);
|
2010-01-12 00:15:12 +00:00
|
|
|
angular.callbacks._iframe_notify_1234 = function () {
|
|
|
|
|
assertEquals("undefined", typeof angularCallbacks._iframe_notify_1234);
|
2010-01-06 00:36:58 +00:00
|
|
|
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 () {
|
2010-01-09 23:02:43 +00:00
|
|
|
assertEquals("<div>&amp;</div>", escapeHtml('<div>&</div>'));
|
2010-01-06 00:36:58 +00:00
|
|
|
};
|