aboutsummaryrefslogtreecommitdiffstats
path: root/test/UrlWatcherTest.js
blob: 6080ca621827fefb09f2c5a4da50eee0a87d6356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
UrlWatcherTest = TestCase('UrlWatcherTest');

UrlWatcherTest.prototype.testUrlWatcher = function () {
  expectAsserts(2);
  var location = {href:"http://server", hash:""};
  var watcher = new UrlWatcher(location);
  watcher.delay = 1;
  watcher.watch(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.start();
};

FunctionTest = TestCase("FunctionTest");

FunctionTest.prototype.testEscapeHtml = function () {
  assertEquals("&lt;div&gt;&amp;amp;&lt;/div&gt;", escapeHtml('<div>&amp;</div>'));
};