diff options
| author | Misko Hevery | 2010-04-19 12:54:39 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-04-19 12:54:39 -0700 | 
| commit | 8e1b670d5b262f70fdbf4c4b01d3109d54a12ac5 (patch) | |
| tree | 0e544718aeb3c2d460e4e7ede533b62ffcccac17 | |
| parent | 8394353b8580eadb9502abbcc963b594c9d9f53f (diff) | |
| download | angular.js-8e1b670d5b262f70fdbf4c4b01d3109d54a12ac5.tar.bz2 | |
fix ie bug with .text() on jqlite
| -rw-r--r-- | src/Compiler.js | 4 | ||||
| -rw-r--r-- | src/jqLite.js | 4 | ||||
| -rw-r--r-- | src/markups.js | 2 | ||||
| -rwxr-xr-x | test.sh | 3 | ||||
| -rw-r--r-- | test/moveToAngularCom/miscTest.js | 79 | 
5 files changed, 32 insertions, 60 deletions
| diff --git a/src/Compiler.js b/src/Compiler.js index a762b5fd..376235f7 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -136,7 +136,7 @@ Compiler.prototype = {        // process markup for text nodes only        eachTextNode(element, function(textNode){          var text = textNode.text(); -        foreach(self.textMarkup, function(markup){ +        foreach(self.textMarkup, function(markup, name){            markup.call(selfApi, text, textNode, element);          });        }); @@ -144,7 +144,7 @@ Compiler.prototype = {      if (directives) {        // Process attributes/directives -      eachAttribute(element, function(value, name){ +      eachAttribute(element, function(value){          foreach(self.attrMarkup, function(markup){            markup.call(selfApi, value, name, element);          }); diff --git a/src/jqLite.js b/src/jqLite.js index 92bc22a7..67e1717c 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -191,9 +191,9 @@ JQLite.prototype = {    text: function(value) {      if (isDefined(value)) { -      this[0].textContent = value; +      this[0].nodeValue = value;      } -    return this[0].textContent; +    return this[0].nodeValue;    },    val: function(value) { diff --git a/src/markups.js b/src/markups.js index 5c069f49..4207d83f 100644 --- a/src/markups.js +++ b/src/markups.js @@ -53,7 +53,7 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {  // TODO: this should be widget not a markup  angularTextMarkup('OPTION', function(text, textNode, parentElement){ -  if (parentElement[0].nodeName == "OPTION") { +  if (nodeName(parentElement) == "OPTION") {      var select = document.createElement('select');      select.insertBefore(parentElement[0].cloneNode(true), null);      if (!select.innerHTML.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)) { @@ -1,2 +1 @@ -java -jar lib/jstestdriver/JsTestDriver.jar --tests all | grep -v lib/jasmine - +java -jar lib/jstestdriver/JsTestDriver.jar --tests BinderTest.testChangingSelectNonSelectedUpdatesModel 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"}\'/>'));  }; - - | 
