diff options
| author | Misko Hevery | 2010-07-13 11:20:11 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-07-13 11:20:11 -0700 |
| commit | 87cfc27be331685043ea2a4414eba4fd8fbb4a2c (patch) | |
| tree | e0c2e5c5919a3177816a30a602d8fc3971df0d4d | |
| parent | 228b54aa2ea9c5faf9280f39317fdf07b2d49580 (diff) | |
| download | angular.js-87cfc27be331685043ea2a4414eba4fd8fbb4a2c.tar.bz2 | |
changed remaining ng- to ng:
| -rw-r--r-- | src/delete/Widgets.js | 6 | ||||
| -rw-r--r-- | src/filters.js | 2 | ||||
| -rw-r--r-- | src/widgets.js | 8 | ||||
| -rw-r--r-- | test/BinderTest.js | 10 | ||||
| -rw-r--r-- | test/FiltersTest.js | 6 | ||||
| -rw-r--r-- | test/ValidatorsTest.js | 6 | ||||
| -rw-r--r-- | test/delete/WidgetsTest.js | 6 | ||||
| -rw-r--r-- | test/servicesSpec.js | 2 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 42 |
9 files changed, 44 insertions, 44 deletions
diff --git a/src/delete/Widgets.js b/src/delete/Widgets.js index d2f0c75a..53536ed0 100644 --- a/src/delete/Widgets.js +++ b/src/delete/Widgets.js @@ -19,7 +19,7 @@ WidgetFactory.prototype = { if (exp) exp = exp.split(':').pop(); var event = "change"; var bubbleEvent = true; - var formatter = angularFormatter[input.attr('ng-format')] || angularFormatter['noop']; + var formatter = angularFormatter[input.attr('ng:format')] || angularFormatter['noop']; if (type == 'button' || type == 'submit' || type == 'reset' || type == 'image') { controller = new ButtonController(input[0], exp, formatter); event = "click"; @@ -191,8 +191,8 @@ function TextController(view, exp, formatter) { this.view = view; this.formatter = formatter; this.exp = exp; - this.validator = view.getAttribute('ng-validate'); - this.required = typeof view.attributes['ng-required'] != "undefined"; + this.validator = view.getAttribute('ng:validate'); + this.required = typeof view.attributes['ng:required'] != "undefined"; this.lastErrorText = null; this.lastValue = undefined; this.initialValue = this.formatter['parse'](view.value); diff --git a/src/filters.js b/src/filters.js index a911b935..24464477 100644 --- a/src/filters.js +++ b/src/filters.js @@ -2,7 +2,7 @@ var angularFilterGoogleChartApi; foreach({ 'currency': function(amount){ - this.$element.toggleClass('ng-format-negative', amount < 0); + this.$element.toggleClass('ng:format-negative', amount < 0); return '$' + angularFilter['number'].apply(this, [amount, 2]); }, diff --git a/src/widgets.js b/src/widgets.js index 94f09c7b..ebfcc456 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -15,7 +15,7 @@ function modelAccessor(scope, element) { function modelFormattedAccessor(scope, element) { var accessor = modelAccessor(scope, element), - formatterName = element.attr('ng-format') || NOOP, + formatterName = element.attr('ng:format') || NOOP, formatter = angularFormatter(formatterName); if (!formatter) throw "Formatter named '" + formatterName + "' not found."; return { @@ -33,10 +33,10 @@ function compileValidator(expr) { } function valueAccessor(scope, element) { - var validatorName = element.attr('ng-validate') || NOOP, + var validatorName = element.attr('ng:validate') || NOOP, validator = compileValidator(validatorName), - requiredExpr = element.attr('ng-required'), - formatterName = element.attr('ng-format') || NOOP, + requiredExpr = element.attr('ng:required'), + formatterName = element.attr('ng:format') || NOOP, formatter = angularFormatter(formatterName), format, parse, lastError, required; invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop}; diff --git a/test/BinderTest.js b/test/BinderTest.js index ef1ef362..1b1201fa 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -42,7 +42,7 @@ BinderTest.prototype.testChangingRadioUpdatesModel = function(){ }; BinderTest.prototype.testChangingCheckboxUpdatesModel = function(){ - var form = this.compile('<input type="checkbox" name="model.price" value="true" checked ng-format="boolean"/>'); + var form = this.compile('<input type="checkbox" name="model.price" value="true" checked ng:format="boolean"/>'); assertEquals(true, form.scope.model.price); }; @@ -508,8 +508,8 @@ BinderTest.prototype.testFillInOptionValueWhenMissing = function() { }; BinderTest.prototype.testValidateForm = function() { - var c = this.compile('<div><input name="name" ng-required>' + - '<div ng:repeat="item in items"><input name="item.name" ng-required/></div></div>'); + var c = this.compile('<div><input name="name" ng:required>' + + '<div ng:repeat="item in items"><input name="item.name" ng:required/></div></div>'); var items = [{}, {}]; c.scope.$set("items", items); c.scope.$eval(); @@ -537,7 +537,7 @@ BinderTest.prototype.testValidateForm = function() { }; BinderTest.prototype.testValidateOnlyVisibleItems = function(){ - var c = this.compile('<div><input name="name" ng-required><input ng:show="show" name="name" ng-required></div>'); + var c = this.compile('<div><input name="name" ng:required><input ng:show="show" name="name" ng:required></div>'); jqLite(document.body).append(c.node); c.scope.$set("show", true); c.scope.$eval(); @@ -660,7 +660,7 @@ BinderTest.prototype.XtestItShouldRenderMultiRootHtmlInBinding = function() { }; BinderTest.prototype.testItShouldUseFormaterForText = function() { - var x = this.compile('<input name="a" ng-format="list" value="a,b">'); + var x = this.compile('<input name="a" ng:format="list" value="a,b">'); x.scope.$eval(); assertEquals(['a','b'], x.scope.$get('a')); var input = x.node; diff --git a/test/FiltersTest.js b/test/FiltersTest.js index f839bb51..903a7a2f 100644 --- a/test/FiltersTest.js +++ b/test/FiltersTest.js @@ -6,11 +6,11 @@ FiltersTest.prototype.testCurrency = function(){ var currency = bind(context, angular.filter.currency); assertEquals(currency(0), '$0.00'); - assertEquals(html.hasClass('ng-format-negative'), false); + assertEquals(html.hasClass('ng:format-negative'), false); assertEquals(currency(-999), '$-999.00'); - assertEquals(html.hasClass('ng-format-negative'), true); + assertEquals(html.hasClass('ng:format-negative'), true); assertEquals(currency(1234.5678), '$1,234.57'); - assertEquals(html.hasClass('ng-format-negative'), false); + assertEquals(html.hasClass('ng:format-negative'), false); }; FiltersTest.prototype.testFilterThisIsContext = function(){ diff --git a/test/ValidatorsTest.js b/test/ValidatorsTest.js index 573c340d..2e156f84 100644 --- a/test/ValidatorsTest.js +++ b/test/ValidatorsTest.js @@ -7,7 +7,7 @@ ValidatorTest.prototype.testItShouldHaveThisSet = function() { validator.last = last; validator._this = this; }; - var scope = compile('<input name="name" ng-validate="myValidator:\'hevery\'"/>'); + var scope = compile('<input name="name" ng:validate="myValidator:\'hevery\'"/>'); scope.name = 'misko'; scope.$init(); assertEquals('misko', validator.first); @@ -109,7 +109,7 @@ describe('Validator:asynchronous', function(){ it('should make a request and show spinner', function(){ var value, fn; - var scope = compile('<input type="text" name="name" ng-validate="asynchronous:asyncFn"/>'); + var scope = compile('<input type="text" name="name" ng:validate="asynchronous:asyncFn"/>'); scope.$init(); var input = scope.$element; scope.asyncFn = function(v,f){ @@ -151,7 +151,7 @@ describe('Validator:asynchronous', function(){ }); it("should handle update function", function(){ - var scope = angular.compile('<input name="name" ng-validate="asynchronous:asyncFn:updateFn"/>'); + var scope = angular.compile('<input name="name" ng:validate="asynchronous:asyncFn:updateFn"/>'); scope.asyncFn = jasmine.createSpy(); scope.updateFn = jasmine.createSpy(); scope.name = 'misko'; diff --git a/test/delete/WidgetsTest.js b/test/delete/WidgetsTest.js index 9acc6126..ccc87afd 100644 --- a/test/delete/WidgetsTest.js +++ b/test/delete/WidgetsTest.js @@ -1,7 +1,7 @@ WidgetTest = TestCase('WidgetTest'); WidgetTest.prototype.testRequired = function () { - var view = $('<input name="a" ng-required>'); + var view = $('<input name="a" ng:required>'); var scope = new Scope({$invalidWidgets:[]}); var cntl = new TextController(view[0], 'a', angularFormatter.noop); cntl.updateView(scope); @@ -14,7 +14,7 @@ WidgetTest.prototype.testRequired = function () { }; WidgetTest.prototype.testValidator = function () { - var view = $('<input name="a" ng-validate="testValidator:\'ABC\'">'); + var view = $('<input name="a" ng:validate="testValidator:\'ABC\'">'); var scope = new Scope({$invalidWidgets:[]}); var cntl = new TextController(view[0], 'a', angularFormatter.noop); angular.validator.testValidator = function(value, expect){ @@ -42,7 +42,7 @@ WidgetTest.prototype.testValidator = function () { }; WidgetTest.prototype.testRequiredValidator = function () { - var view = $('<input name="a" ng-required ng-validate="testValidator:\'ABC\'">'); + var view = $('<input name="a" ng:required ng:validate="testValidator:\'ABC\'">'); var scope = new Scope({$invalidWidgets:[]}); var cntl = new TextController(view[0], 'a', angularFormatter.noop); angular.validator.testValidator = function(value, expect){ diff --git a/test/servicesSpec.js b/test/servicesSpec.js index f679a39b..32e7812a 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -136,7 +136,7 @@ describe("service", function(){ describe("$invalidWidgets", function(){ it("should count number of invalid widgets", function(){ - var scope = compile('<input name="price" ng-required ng-validate="number"></input>').$init(); + var scope = compile('<input name="price" ng:required ng:validate="number"></input>').$init(); expect(scope.$invalidWidgets.length).toEqual(1); scope.price = 123; scope.$eval(); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 158b24a8..1c9e698a 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -41,10 +41,10 @@ describe("widget", function(){ expect(scope.$get('count')).toEqual(2); }); - describe("ng-format", function(){ + describe("ng:format", function(){ it("should format text", function(){ - compile('<input type="Text" name="list" value="a,b,c" ng-format="list"/>'); + compile('<input type="Text" name="list" value="a,b,c" ng:format="list"/>'); expect(scope.$get('list')).toEqual(['a', 'b', 'c']); scope.$set('list', ['x', 'y', 'z']); @@ -57,7 +57,7 @@ describe("widget", function(){ }); it("should come up blank if null", function(){ - compile('<input type="text" name="age" ng-format="number"/>', function(){ + compile('<input type="text" name="age" ng:format="number"/>', function(){ scope.age = null; }); expect(scope.age).toBeNull(); @@ -65,7 +65,7 @@ describe("widget", function(){ }); it("should show incorect text while number does not parse", function(){ - compile('<input type="text" name="age" ng-format="number"/>'); + compile('<input type="text" name="age" ng:format="number"/>'); scope.age = 123; scope.$eval(); scope.$element.val('123X'); @@ -76,14 +76,14 @@ describe("widget", function(){ }); it("should clober incorect text if model changes", function(){ - compile('<input type="text" name="age" ng-format="number" value="123X"/>'); + compile('<input type="text" name="age" ng:format="number" value="123X"/>'); scope.age = 456; scope.$eval(); expect(scope.$element.val()).toEqual('456'); }); it("should not clober text if model changes doe to itself", function(){ - compile('<input type="text" name="list" ng-format="list" value="a"/>'); + compile('<input type="text" name="list" ng:format="list" value="a"/>'); scope.$element.val('a '); scope.$element.trigger('change'); @@ -107,7 +107,7 @@ describe("widget", function(){ }); it("should come up blank when no value specifiend", function(){ - compile('<input type="text" name="age" ng-format="number"/>'); + compile('<input type="text" name="age" ng:format="number"/>'); scope.$eval(); expect(scope.$element.val()).toEqual(''); expect(scope.age).toEqual(null); @@ -134,7 +134,7 @@ describe("widget", function(){ expect(scope.checkbox).toEqual(true); }); - it("should use ng-format", function(){ + it("should use ng:format", function(){ angularFormatter('testFormat', { parse: function(value){ return value ? "Worked" : "Failed"; @@ -146,7 +146,7 @@ describe("widget", function(){ } }); - compile('<input type="checkbox" name="state" ng-format="testFormat" checked/>'); + compile('<input type="checkbox" name="state" ng:format="testFormat" checked/>'); expect(scope.state).toEqual("Worked"); expect(scope.$element[0].checked).toEqual(true); @@ -161,9 +161,9 @@ describe("widget", function(){ }); }); - describe("ng-validate", function(){ - it("should process ng-validate", function(){ - compile('<input type="text" name="price" value="abc" ng-validate="number"/>'); + describe("ng:validate", function(){ + it("should process ng:validate", function(){ + compile('<input type="text" name="price" value="abc" ng:validate="number"/>'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); expect(element.attr('ng-validation-error')).toEqual('Not a number'); @@ -179,7 +179,7 @@ describe("widget", function(){ }); it('should not blow up for validation with bound attributes', function() { - compile('<input type="text" name="price" boo="{{abc}}" ng-required/>'); + compile('<input type="text" name="price" boo="{{abc}}" ng:required/>'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); expect(element.attr('ng-validation-error')).toEqual('Required'); @@ -192,7 +192,7 @@ describe("widget", function(){ it("should not call validator if undefined/empty", function(){ var lastValue = "NOT_CALLED"; angularValidator.myValidator = function(value){lastValue = value;}; - compile('<input type="text" name="url" ng-validate="myValidator"/>'); + compile('<input type="text" name="url" ng:validate="myValidator"/>'); expect(lastValue).toEqual("NOT_CALLED"); scope.url = 'http://server'; @@ -205,19 +205,19 @@ describe("widget", function(){ }); it("should ignore disabled widgets", function(){ - compile('<input type="text" name="price" ng-required disabled/>'); + compile('<input type="text" name="price" ng:required disabled/>'); expect(element.hasClass('ng-validation-error')).toBeFalsy(); expect(element.attr('ng-validation-error')).toBeFalsy(); }); it("should ignore readonly widgets", function(){ - compile('<input type="text" name="price" ng-required readonly/>'); + compile('<input type="text" name="price" ng:required readonly/>'); expect(element.hasClass('ng-validation-error')).toBeFalsy(); expect(element.attr('ng-validation-error')).toBeFalsy(); }); - it("should process ng-required", function(){ - compile('<input type="text" name="price" ng-required/>'); + it("should process ng:required", function(){ + compile('<input type="text" name="price" ng:required/>'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); expect(element.attr('ng-validation-error')).toEqual('Required'); @@ -232,8 +232,8 @@ describe("widget", function(){ expect(element.attr('ng-validation-error')).toEqual('Required'); }); - it('should allow conditions on ng-required', function() { - compile('<input type="text" name="price" ng-required="ineedz"/>'); + it('should allow conditions on ng:required', function() { + compile('<input type="text" name="price" ng:required="ineedz"/>'); scope.$set('ineedz', false); scope.$eval(); expect(element.hasClass('ng-validation-error')).toBeFalsy(); @@ -256,7 +256,7 @@ describe("widget", function(){ expect(element.attr('ng-validation-error')).toBeFalsy(); }); - it("should process ng-required2", function() { + it("should process ng:required2", function() { compile('<textarea name="name">Misko</textarea>'); expect(scope.$get('name')).toEqual("Misko"); |
