|
1 |
| -ParserTest.prototype.testReturnFunctionsAreNotBound = function(){ |
2 |
| - var scope = createScope(); |
3 |
| - scope.entity("Group", new DataStore()); |
4 |
| - var Group = scope.$get("Group"); |
5 |
| - assertEquals("eval Group", "function", typeof scope.$eval("Group")); |
6 |
| - assertEquals("direct Group", "function", typeof Group); |
7 |
| - assertEquals("eval Group.all", "function", typeof scope.$eval("Group.query")); |
8 |
| - assertEquals("direct Group.all", "function", typeof Group.query); |
9 |
| -}; |
10 |
| - |
11 |
| -ParserTest.prototype.XtestItShouldParseEmptyOnChangeAsNoop = function () { |
12 |
| - var scope = createScope(); |
13 |
| - scope.watch("", function(){fail();}); |
14 |
| -}; |
15 |
| - |
16 |
| - |
17 |
| -ParserTest.prototype.XtestItShouldParseOnChangeIntoHashSet = function () { |
18 |
| - var scope = createScope({count:0}); |
19 |
| - scope.watch("$anchor.a:count=count+1;$anchor.a:count=count+20;b:count=count+300"); |
20 |
| - |
21 |
| - scope.watchListeners["$anchor.a"].listeners[0](); |
22 |
| - assertEquals(1, scope.$get("count")); |
23 |
| - scope.watchListeners["$anchor.a"].listeners[1](); |
24 |
| - assertEquals(21, scope.$get("count")); |
25 |
| - scope.watchListeners["b"].listeners[0]({scope:scope}); |
26 |
| - assertEquals(321, scope.$get("count")); |
| 1 | +BinderTest.prototype.testExpandEntityTagWithName = function(){ |
| 2 | + var c = this.compile('<div ng-entity="friend=Person"/>'); |
| 3 | + assertEquals( |
| 4 | + '<div ng-entity="friend=Person" ng-watch="$anchor.friend:{friend=Person.load($anchor.friend);friend.$$anchor=\"friend\";};"></div>', |
| 5 | + sortedHtml(c.node)); |
| 6 | + assertEquals("Person", c.scope.$get("friend.$entity")); |
| 7 | + assertEquals("friend", c.scope.$get("friend.$$anchor")); |
27 | 8 | };
|
28 |
| -ParserTest.prototype.XtestItShouldParseOnChangeBlockIntoHashSet = function () { |
29 |
| - var scope = createScope({count:0}); |
30 |
| - var listeners = {a:[], b:[]}; |
31 |
| - scope.watch("a:{count=count+1;count=count+20;};b:count=count+300", |
32 |
| - function(n, fn){listeners[n].push(fn);}); |
33 | 9 |
|
34 |
| - assertEquals(1, scope.watchListeners.a.listeners.length); |
35 |
| - assertEquals(1, scope.watchListeners.b.listeners.length); |
36 |
| - scope.watchListeners["a"].listeners[0](); |
37 |
| - assertEquals(21, scope.$get("count")); |
38 |
| - scope.watchListeners["b"].listeners[0](); |
39 |
| - assertEquals(321, scope.$get("count")); |
| 10 | +BinderTest.prototype.testExpandSubmitButtonToAction = function(){ |
| 11 | + var html = this.compileToHtml('<input type="submit" value="Save">'); |
| 12 | + assertTrue(html, html.indexOf('ng-action="$save()"') > 0 ); |
| 13 | + assertTrue(html, html.indexOf('ng-bind-attr="{"disabled":"{{$invalidWidgets}}"}"') > 0 ); |
40 | 14 | };
|
41 | 15 |
|
42 |
| -FiltersTest.prototype.testBytes = function(){ |
43 |
| - var controller = new FileController(); |
44 |
| - assertEquals(angular.filter.bytes(123), '123 bytes'); |
45 |
| - assertEquals(angular.filter.bytes(1234), '1.2 KB'); |
46 |
| - assertEquals(angular.filter.bytes(1234567), '1.1 MB'); |
| 16 | +BinderTest.prototype.testReplaceFileUploadWithSwf = function(){ |
| 17 | + expectAsserts(1); |
| 18 | + var form = jQuery("body").append('<div id="testTag"><input type="file"></div>'); |
| 19 | + form.data('scope', new Scope()); |
| 20 | + var factory = {}; |
| 21 | + var binder = new Binder(form.get(0), factory, new MockLocation()); |
| 22 | + factory.createController = function(node){ |
| 23 | + assertEquals(node.attr('type'), 'file'); |
| 24 | + return {updateModel:function(){}}; |
| 25 | + }; |
| 26 | + binder.compile(); |
| 27 | + jQuery("#testTag").remove(); |
47 | 28 | };
|
48 | 29 |
|
49 |
| -BinderTest.prototype.testDissableAutoSubmit = function() { |
50 |
| - var c = this.compile('<input type="submit" value="S"/>', null, {autoSubmit:true}); |
51 |
| - assertEquals( |
52 |
| - '<input ng-action="$save()" ng-bind-attr="{"disabled":"{{$invalidWidgets}}"}" type="submit" value="S"></input>', |
53 |
| - sortedHtml(c.node)); |
54 |
| - |
55 |
| - c = this.compile('<input type="submit" value="S"/>', null, {autoSubmit:false}); |
| 30 | +BinderTest.prototype.testExpandEntityTagWithDefaults = function(){ |
56 | 31 | assertEquals(
|
57 |
| - '<input type="submit" value="S"></input>', |
58 |
| - sortedHtml(c.node)); |
| 32 | + '<div ng-entity="Person:{a:\"a\"}" ng-watch=""></div>', |
| 33 | + this.compileToHtml('<div ng-entity=\'Person:{a:"a"}\'/>')); |
59 | 34 | };
|
60 | 35 |
|
61 |
| - |
62 |
| - |
0 commit comments