aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularTest.js
diff options
context:
space:
mode:
authorMisko Hevery2010-01-18 10:47:03 -0800
committerMisko Hevery2010-01-18 10:47:03 -0800
commit595b4ea097bcb512173b6d4a12924ea1a3d70ecd (patch)
tree24a85ee2ab41d6eb16661cf4d55443954c6c62c0 /test/AngularTest.js
parent27709c3f69384a7630aa336a1e73e730ea5f9790 (diff)
downloadangular.js-595b4ea097bcb512173b6d4a12924ea1a3d70ecd.tar.bz2
checkpoint for integration with angular
Diffstat (limited to 'test/AngularTest.js')
-rw-r--r--test/AngularTest.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/AngularTest.js b/test/AngularTest.js
new file mode 100644
index 00000000..9610ef76
--- /dev/null
+++ b/test/AngularTest.js
@@ -0,0 +1,60 @@
+AngularTest = TestCase('AngularTest');
+
+AngularTest.prototype.testDefaultDatabasePathFromSubdomain = function() {
+ var loader = new Angular(null, null, {server:"http://account.getangular.com", database:"database"});
+ loader.computeConfiguration();
+ assertEquals("database", loader.config.database);
+
+ loader = new Angular(null, null, {server:"http://account.getangular.com"});
+ loader.computeConfiguration();
+ assertEquals("account", loader.config.database);
+
+ loader = new Angular(null, null, {server:"https://account.getangular.com"});
+ loader.computeConfiguration();
+ assertEquals("account", loader.config.database);
+};
+
+
+
+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("&lt;div&gt;&amp;amp;&lt;/div&gt;", escapeHtml('<div>&amp;</div>'));
+}; \ No newline at end of file