aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMisko Hevery2010-04-19 12:54:39 -0700
committerMisko Hevery2010-04-19 12:54:39 -0700
commit8e1b670d5b262f70fdbf4c4b01d3109d54a12ac5 (patch)
tree0e544718aeb3c2d460e4e7ede533b62ffcccac17 /test
parent8394353b8580eadb9502abbcc963b594c9d9f53f (diff)
downloadangular.js-8e1b670d5b262f70fdbf4c4b01d3109d54a12ac5.tar.bz2
fix ie bug with .text() on jqlite
Diffstat (limited to 'test')
-rw-r--r--test/moveToAngularCom/miscTest.js79
1 files changed, 26 insertions, 53 deletions
diff --git a/test/moveToAngularCom/miscTest.js b/test/moveToAngularCom/miscTest.js
index a986f259..aa0e1186 100644
--- a/test/moveToAngularCom/miscTest.js
+++ b/test/moveToAngularCom/miscTest.js
@@ -1,62 +1,35 @@
-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"));
+BinderTest.prototype.testExpandEntityTagWithName = function(){
+ var c = this.compile('<div ng-entity="friend=Person"/>');
+ assertEquals(
+ '<div ng-entity="friend=Person" ng-watch="$anchor.friend:{friend=Person.load($anchor.friend);friend.$$anchor=\"friend\";};"></div>',
+ sortedHtml(c.node));
+ assertEquals("Person", c.scope.$get("friend.$entity"));
+ assertEquals("friend", c.scope.$get("friend.$$anchor"));
};
-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"));
+BinderTest.prototype.testExpandSubmitButtonToAction = function(){
+ var html = this.compileToHtml('<input type="submit" value="Save">');
+ assertTrue(html, html.indexOf('ng-action="$save()"') > 0 );
+ assertTrue(html, html.indexOf('ng-bind-attr="{"disabled":"{{$invalidWidgets}}"}"') > 0 );
};
-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.testReplaceFileUploadWithSwf = function(){
+ expectAsserts(1);
+ var form = jQuery("body").append('<div id="testTag"><input type="file"></div>');
+ form.data('scope', new Scope());
+ var factory = {};
+ var binder = new Binder(form.get(0), factory, new MockLocation());
+ factory.createController = function(node){
+ assertEquals(node.attr('type'), 'file');
+ return {updateModel:function(){}};
+ };
+ binder.compile();
+ jQuery("#testTag").remove();
};
-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});
+BinderTest.prototype.testExpandEntityTagWithDefaults = function(){
assertEquals(
- '<input type="submit" value="S"></input>',
- sortedHtml(c.node));
+ '<div ng-entity="Person:{a:\"a\"}" ng-watch=""></div>',
+ this.compileToHtml('<div ng-entity=\'Person:{a:"a"}\'/>'));
};
-
-