diff options
| -rw-r--r-- | src/directives.js | 17 | ||||
| -rwxr-xr-x | test.sh | 3 | ||||
| -rw-r--r-- | test/FiltersTest.js | 19 | ||||
| -rw-r--r-- | test/directivesSpec.js | 15 | ||||
| -rw-r--r-- | test/testabilityPatch.js | 4 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 2 | 
6 files changed, 27 insertions, 33 deletions
diff --git a/src/directives.js b/src/directives.js index aa75aa5b..2d318be2 100644 --- a/src/directives.js +++ b/src/directives.js @@ -97,20 +97,21 @@ angularDirective("ng-bind-template", function(expression){  });  var REMOVE_ATTRIBUTES = { -  'disabled':true, -  'readonly':true, -  'checked':true +  'disabled':'disabled', +  'readonly':'readOnly', +  'checked':'checked'  };  angularDirective("ng-bind-attr", function(expression){    return function(element){      this.$onEval(function(){        foreach(this.$eval(expression), function(bindExp, key) { -        var value = compileBindTemplate(bindExp).call(this, element); -        if (REMOVE_ATTRIBUTES[lowercase(key)]) { -          if (!toBoolean(value)) { -            element.removeAttr(key); -          } else { +        var value = compileBindTemplate(bindExp).call(this, element), +            specialName = REMOVE_ATTRIBUTES[lowercase(key)]; +        if (specialName) { +          if (element[specialName] = toBoolean(value)) {              element.attr(key, value); +          } else { +            element.removeAttr(key);            }            (element.data('$validate')||noop)();          } else { @@ -1 +1,2 @@ -java -jar lib/jstestdriver/JsTestDriver.jar --tests all +# java -jar lib/jstestdriver/JsTestDriver.jar --tests all +java -jar lib/jstestdriver/JsTestDriver.jar --tests all --config jsTestDriver-jquery.conf diff --git a/test/FiltersTest.js b/test/FiltersTest.js index 5642f635..f839bb51 100644 --- a/test/FiltersTest.js +++ b/test/FiltersTest.js @@ -80,22 +80,13 @@ FiltersTest.prototype.testImage = function(){    assertEquals(null, angular.filter.image());    assertEquals(null, angular.filter.image({}));    assertEquals(null, angular.filter.image("")); -  assertEquals('<img src="http://localhost/abc"></img>', sortedHtml(angular.filter.image({url:"http://localhost/abc"}))); -  assertEquals( -      '<img src="http://localhost/abc" style="max-height: 10px; max-width: 10px;"></img>', -      sortedHtml(angular.filter.image({url:"http://localhost/abc"}, 10))); -  assertEquals( -      '<img src="http://localhost/abc" style="max-height: 20px; max-width: 10px;"></img>', -      sortedHtml(angular.filter.image({url:"http://localhost/abc"}, 10, 20))); +  assertEquals('http://localhost/abc', angular.filter.image({url:"http://localhost/abc"}).attr('src'));  };  FiltersTest.prototype.testQRcode = function() {    assertEquals( -      '<img src="http://chart.apis.google.com/chart?chl=Hello%20world&chs=200x200&cht=qr" style="height: 200px; width: 200px;"></img>', -      sortedHtml(angular.filter.qrcode('Hello world'))); -  assertEquals( -      '<img src="http://chart.apis.google.com/chart?chl=http%3A%2F%2Fserver%3Fa%26b%3Dc&chs=100x100&cht=qr" style="height: 100px; width: 100px;"></img>', -      sortedHtml(angular.filter.qrcode('http://server?a&b=c', 100))); +      'http://chart.apis.google.com/chart?chl=Hello%20world&chs=200x200&cht=qr', +      angular.filter.qrcode('Hello world').attr('src'));  };  FiltersTest.prototype.testLowercase = function() { @@ -128,8 +119,8 @@ FiltersTest.prototype.testUnless = function() {  FiltersTest.prototype.testGoogleChartApiEncode = function() {    assertEquals( -      '<img src="http://chart.apis.google.com/chart?chl=Hello world&chs=200x200&cht=qr" style="height: 200px; width: 200px;"></img>', -      sortedHtml(angular.filter.googleChartApi.encode({cht:"qr", chl:"Hello world"}))); +      'http://chart.apis.google.com/chart?chl=Hello world&chs=200x200&cht=qr', +      angular.filter.googleChartApi.encode({cht:"qr", chl:"Hello world"}).attr('src'));  };  FiltersTest.prototype.testHtml = function() { diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 71402af7..eb8a9785 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -58,19 +58,20 @@ describe("directives", function(){    });    it('should remove special attributes on false', function(){ -    var scope = compile('<div ng-bind-attr="{disabled:\'{{disabled}}\', readonly:\'{{readonly}}\', checked:\'{{checked}}\'}"/>'); -    expect(scope.$element.attr('disabled')).toEqual(null); -    expect(scope.$element.attr('readonly')).toEqual(null); -    expect(scope.$element.attr('checked')).toEqual(null); +    var scope = compile('<input ng-bind-attr="{disabled:\'{{disabled}}\', readonly:\'{{readonly}}\', checked:\'{{checked}}\'}"/>'); +    var input = scope.$element[0]; +    expect(input.disabled).toEqual(false); +    expect(input.readOnly).toEqual(false); +    expect(input.checked).toEqual(false);      scope.disabled = true;      scope.readonly = true;      scope.checked = true;      scope.$eval(); -    expect(scope.$element.attr('disabled')).not.toEqual(null); -    expect(scope.$element.attr('readonly')).not.toEqual(null); -    expect(scope.$element.attr('checked')).not.toEqual(null); +    expect(input.disabled).toEqual(true); +    expect(input.readOnly).toEqual(true); +    expect(input.checked).toEqual(true);    });    it('should ng-non-bindable', function(){ diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index 1e6ed970..ff537a09 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -145,9 +145,9 @@ error = noop;  function click(element) {    element = jqLite(element); -  if ( (msie || jqLite == window.jQuery) && +  if ( msie &&         nodeName(element) == 'INPUT' && (lowercase(element.attr('type')) == 'radio' || lowercase(element.attr('type')) == 'checkbox')) {      element[0].checked = ! element[0].checked;    } -  element.trigger('click'); +  JQLite.prototype.trigger.call(element, 'click');  } diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 3aa5e250..5b1e7b8e 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -160,7 +160,7 @@ describe("widget", function(){      it('should support type="radio"', function(){        compile('<div>' +            '<input type="radio" name="chose" value="A" ng-change="clicked = 1"/>' + -          '<input type="raDio" name="chose" value="B" checked ng-change="clicked = 2"/>' + +          '<input type="radio" name="chose" value="B" checked ng-change="clicked = 2"/>' +            '<input type="radio" name="chose" value="C" ng-change="clicked = 3"/>' +          '</div>');        var a = element[0].childNodes[0];  | 
