aboutsummaryrefslogtreecommitdiffstats
path: root/test/moveToAngularCom/miscTest.js
diff options
context:
space:
mode:
authorMisko Hevery2010-04-08 13:43:40 -0700
committerMisko Hevery2010-04-08 13:43:40 -0700
commitc4ef1f2fdd73bdaeda879e596d3d96e4e68cb6fd (patch)
tree3fc1943a4599a764aef9a41d995246bb0e48f463 /test/moveToAngularCom/miscTest.js
parente0ad7dfcd47196d0aa9271e84b2c4ac26cfda3f4 (diff)
downloadangular.js-c4ef1f2fdd73bdaeda879e596d3d96e4e68cb6fd.tar.bz2
tests failing jstd to show cory
Diffstat (limited to 'test/moveToAngularCom/miscTest.js')
-rw-r--r--test/moveToAngularCom/miscTest.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/moveToAngularCom/miscTest.js b/test/moveToAngularCom/miscTest.js
new file mode 100644
index 00000000..a986f259
--- /dev/null
+++ b/test/moveToAngularCom/miscTest.js
@@ -0,0 +1,62 @@
+ParserTest.prototype.testReturnFunctionsAreNotBound = function(){
+ var scope = createScope();
+ scope.entity("Group", new DataStore());
+ var Group = scope.$get("Group");
+ assertEquals("eval Group", "function", typeof scope.$eval("Group"));
+ assertEquals("direct Group", "function", typeof Group);
+ assertEquals("eval Group.all", "function", typeof scope.$eval("Group.query"));
+ assertEquals("direct Group.all", "function", typeof Group.query);
+};
+
+ParserTest.prototype.XtestItShouldParseEmptyOnChangeAsNoop = function () {
+ var scope = createScope();
+ scope.watch("", function(){fail();});
+};
+
+
+ParserTest.prototype.XtestItShouldParseOnChangeIntoHashSet = function () {
+ var scope = createScope({count:0});
+ scope.watch("$anchor.a:count=count+1;$anchor.a:count=count+20;b:count=count+300");
+
+ scope.watchListeners["$anchor.a"].listeners[0]();
+ assertEquals(1, scope.$get("count"));
+ scope.watchListeners["$anchor.a"].listeners[1]();
+ assertEquals(21, scope.$get("count"));
+ scope.watchListeners["b"].listeners[0]({scope:scope});
+ assertEquals(321, scope.$get("count"));
+};
+ParserTest.prototype.XtestItShouldParseOnChangeBlockIntoHashSet = function () {
+ var scope = createScope({count:0});
+ var listeners = {a:[], b:[]};
+ scope.watch("a:{count=count+1;count=count+20;};b:count=count+300",
+ function(n, fn){listeners[n].push(fn);});
+
+ assertEquals(1, scope.watchListeners.a.listeners.length);
+ assertEquals(1, scope.watchListeners.b.listeners.length);
+ scope.watchListeners["a"].listeners[0]();
+ assertEquals(21, scope.$get("count"));
+ scope.watchListeners["b"].listeners[0]();
+ assertEquals(321, scope.$get("count"));
+};
+
+FiltersTest.prototype.testBytes = function(){
+ var controller = new FileController();
+ assertEquals(angular.filter.bytes(123), '123 bytes');
+ assertEquals(angular.filter.bytes(1234), '1.2 KB');
+ assertEquals(angular.filter.bytes(1234567), '1.1 MB');
+};
+
+BinderTest.prototype.testDissableAutoSubmit = function() {
+ var c = this.compile('<input type="submit" value="S"/>', null, {autoSubmit:true});
+ assertEquals(
+ '<input ng-action="$save()" ng-bind-attr="{"disabled":"{{$invalidWidgets}}"}" type="submit" value="S"></input>',
+ sortedHtml(c.node));
+
+ c = this.compile('<input type="submit" value="S"/>', null, {autoSubmit:false});
+ assertEquals(
+ '<input type="submit" value="S"></input>',
+ sortedHtml(c.node));
+};
+
+
+