diff options
| author | Misko Hevery | 2010-07-02 15:39:47 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-07-02 15:39:57 -0700 |
| commit | 1f0562150921ea2f05149b64ef0440937491def9 (patch) | |
| tree | 20c1c2c69038a7d02d720b811453df6438d274a5 /test | |
| parent | 105e9443c4170870dd34f69073a6eafaabeaf567 (diff) | |
| download | angular.js-1f0562150921ea2f05149b64ef0440937491def9.tar.bz2 | |
change all attributes from ng- to ng: prefix
Diffstat (limited to 'test')
| -rw-r--r-- | test/BinderTest.js | 148 | ||||
| -rw-r--r-- | test/ScenarioSpec.js | 2 | ||||
| -rw-r--r-- | test/delete/WidgetsTest.js | 2 | ||||
| -rw-r--r-- | test/directivesSpec.js | 90 | ||||
| -rw-r--r-- | test/markupSpec.js | 10 | ||||
| -rw-r--r-- | test/moveToAngularCom/miscTest.js | 6 | ||||
| -rw-r--r-- | test/testabilityPatch.js | 4 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 8 |
8 files changed, 135 insertions, 135 deletions
diff --git a/test/BinderTest.js b/test/BinderTest.js index ecdd506f..6dc47cce 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -47,7 +47,7 @@ BinderTest.prototype.testChangingCheckboxUpdatesModel = function(){ }; BinderTest.prototype.testBindUpdate = function() { - var c = this.compile('<div ng-eval="a=123"/>'); + var c = this.compile('<div ng:eval="a=123"/>'); assertEquals(123, c.scope.$get('a')); }; @@ -71,26 +71,26 @@ BinderTest.prototype.testChangingSelectSelectedUpdatesModel = function(){ }; BinderTest.prototype.testExecuteInitialization = function() { - var c = this.compile('<div ng-init="a=123">'); + var c = this.compile('<div ng:init="a=123">'); assertEquals(c.scope.$get('a'), 123); }; BinderTest.prototype.testExecuteInitializationStatements = function() { - var c = this.compile('<div ng-init="a=123;b=345">'); + var c = this.compile('<div ng:init="a=123;b=345">'); assertEquals(c.scope.$get('a'), 123); assertEquals(c.scope.$get('b'), 345); }; BinderTest.prototype.testApplyTextBindings = function(){ - var form = this.compile('<div ng-bind="model.a">x</div>'); + var form = this.compile('<div ng:bind="model.a">x</div>'); form.scope.$set('model', {a:123}); form.scope.$eval(); assertEquals('123', form.node.text()); }; BinderTest.prototype.testReplaceBindingInTextWithSpan = function() { - assertEquals(this.compileToHtml("<b>a{{b}}c</b>"), '<b>a<span ng-bind="b"></span>c</b>'); - assertEquals(this.compileToHtml("<b>{{b}}</b>"), '<b><span ng-bind="b"></span></b>'); + assertEquals(this.compileToHtml("<b>a{{b}}c</b>"), '<b>a<span ng:bind="b"></span>c</b>'); + assertEquals(this.compileToHtml("<b>{{b}}</b>"), '<b><span ng:bind="b"></span></b>'); }; BinderTest.prototype.testBindingSpaceConfusesIE = function() { @@ -99,16 +99,16 @@ BinderTest.prototype.testBindingSpaceConfusesIE = function() { span.innerHTML = ' '; var nbsp = span.firstChild.nodeValue; assertEquals( - '<b><span ng-bind="a"></span><span>'+nbsp+'</span><span ng-bind="b"></span></b>', + '<b><span ng:bind="a"></span><span>'+nbsp+'</span><span ng:bind="b"></span></b>', this.compileToHtml("<b>{{a}} {{b}}</b>")); assertEquals( - '<b><span ng-bind="A"></span><span>'+nbsp+'x </span><span ng-bind="B"></span><span>'+nbsp+'(</span><span ng-bind="C"></span>)</b>', + '<b><span ng:bind="A"></span><span>'+nbsp+'x </span><span ng:bind="B"></span><span>'+nbsp+'(</span><span ng:bind="C"></span>)</b>', this.compileToHtml("<b>{{A}} x {{B}} ({{C}})</b>")); }; BinderTest.prototype.testBindingOfAttributes = function() { var c = this.compile("<a href='http://s/a{{b}}c' foo='x'></a>"); - var attrbinding = c.node.attr("ng-bind-attr"); + var attrbinding = c.node.attr("ng:bind-attr"); var bindings = fromJson(attrbinding); assertEquals("http://s/a{{b}}c", decodeURI(bindings.href)); assertTrue(!bindings.foo); @@ -116,7 +116,7 @@ BinderTest.prototype.testBindingOfAttributes = function() { BinderTest.prototype.testMarkMultipleAttributes = function() { var c = this.compile('<a href="http://s/a{{b}}c" foo="{{d}}"></a>'); - var attrbinding = c.node.attr("ng-bind-attr"); + var attrbinding = c.node.attr("ng:bind-attr"); var bindings = fromJson(attrbinding); assertEquals(bindings.foo, "{{d}}"); assertEquals(decodeURI(bindings.href), "http://s/a{{b}}c"); @@ -126,17 +126,17 @@ BinderTest.prototype.testAttributesNoneBound = function() { var c = this.compile("<a href='abc' foo='def'></a>"); var a = c.node; assertEquals(a[0].nodeName, "A"); - assertTrue(!a.attr("ng-bind-attr")); + assertTrue(!a.attr("ng:bind-attr")); }; BinderTest.prototype.testExistingAttrbindingIsAppended = function() { - var c = this.compile("<a href='http://s/{{abc}}' ng-bind-attr='{\"b\":\"{{def}}\"}'></a>"); + var c = this.compile("<a href='http://s/{{abc}}' ng:bind-attr='{\"b\":\"{{def}}\"}'></a>"); var a = c.node; - assertEquals('{"b":"{{def}}","href":"http://s/{{abc}}"}', a.attr('ng-bind-attr')); + assertEquals('{"b":"{{def}}","href":"http://s/{{abc}}"}', a.attr('ng:bind-attr')); }; BinderTest.prototype.testAttributesAreEvaluated = function(){ - var c = this.compile('<a ng-bind-attr=\'{"a":"a", "b":"a+b={{a+b}}"}\'></a>'); + var c = this.compile('<a ng:bind-attr=\'{"a":"a", "b":"a+b={{a+b}}"}\'></a>'); var binder = c.binder, form = c.node; c.scope.$eval('a=1;b=2'); c.scope.$eval(); @@ -147,7 +147,7 @@ BinderTest.prototype.testAttributesAreEvaluated = function(){ BinderTest.prototype.testInputTypeButtonActionExecutesInScope = function(){ var savedCalled = false; - var c = this.compile('<input type="button" ng-click="person.save()" value="Apply">'); + var c = this.compile('<input type="button" ng:click="person.save()" value="Apply">'); c.scope.$set("person.save", function(){ savedCalled = true; }); @@ -157,7 +157,7 @@ BinderTest.prototype.testInputTypeButtonActionExecutesInScope = function(){ BinderTest.prototype.testInputTypeButtonActionExecutesInScope2 = function(){ var log = ""; - var c = this.compile('<input type="image" ng-click="action()">'); + var c = this.compile('<input type="image" ng:click="action()">'); c.scope.$set("action", function(){ log += 'click;'; }); @@ -168,7 +168,7 @@ BinderTest.prototype.testInputTypeButtonActionExecutesInScope2 = function(){ BinderTest.prototype.testButtonElementActionExecutesInScope = function(){ var savedCalled = false; - var c = this.compile('<button ng-click="person.save()">Apply</button>'); + var c = this.compile('<button ng:click="person.save()">Apply</button>'); c.scope.$set("person.save", function(){ savedCalled = true; }); @@ -177,7 +177,7 @@ BinderTest.prototype.testButtonElementActionExecutesInScope = function(){ }; BinderTest.prototype.testRepeaterUpdateBindings = function(){ - var a = this.compile('<ul><LI ng-repeat="item in model.items" ng-bind="item.a"/></ul>'); + var a = this.compile('<ul><LI ng:repeat="item in model.items" ng:bind="item.a"/></ul>'); var form = a.node; var items = [{a:"A"}, {a:"B"}]; a.scope.$set('model', {items:items}); @@ -185,25 +185,25 @@ BinderTest.prototype.testRepeaterUpdateBindings = function(){ a.scope.$eval(); assertEquals('<ul>' + '<#comment></#comment>' + - '<li ng-bind="item.a" ng-repeat-index="0">A</li>' + - '<li ng-bind="item.a" ng-repeat-index="1">B</li>' + + '<li ng:bind="item.a" ng:repeat-index="0">A</li>' + + '<li ng:bind="item.a" ng:repeat-index="1">B</li>' + '</ul>', sortedHtml(form)); items.unshift({a:'C'}); a.scope.$eval(); assertEquals('<ul>' + '<#comment></#comment>' + - '<li ng-bind="item.a" ng-repeat-index="0">C</li>' + - '<li ng-bind="item.a" ng-repeat-index="1">A</li>' + - '<li ng-bind="item.a" ng-repeat-index="2">B</li>' + + '<li ng:bind="item.a" ng:repeat-index="0">C</li>' + + '<li ng:bind="item.a" ng:repeat-index="1">A</li>' + + '<li ng:bind="item.a" ng:repeat-index="2">B</li>' + '</ul>', sortedHtml(form)); items.shift(); a.scope.$eval(); assertEquals('<ul>' + '<#comment></#comment>' + - '<li ng-bind="item.a" ng-repeat-index="0">A</li>' + - '<li ng-bind="item.a" ng-repeat-index="1">B</li>' + + '<li ng:bind="item.a" ng:repeat-index="0">A</li>' + + '<li ng:bind="item.a" ng:repeat-index="1">B</li>' + '</ul>', sortedHtml(form)); items.shift(); @@ -212,19 +212,19 @@ BinderTest.prototype.testRepeaterUpdateBindings = function(){ }; BinderTest.prototype.testRepeaterContentDoesNotBind = function(){ - var a = this.compile('<ul><LI ng-repeat="item in model.items"><span ng-bind="item.a"></span></li></ul>'); + var a = this.compile('<ul><LI ng:repeat="item in model.items"><span ng:bind="item.a"></span></li></ul>'); a.scope.$set('model', {items:[{a:"A"}]}); a.scope.$eval(); assertEquals('<ul>' + '<#comment></#comment>' + - '<li ng-repeat-index="0"><span ng-bind="item.a">A</span></li>' + + '<li ng:repeat-index="0"><span ng:bind="item.a">A</span></li>' + '</ul>', sortedHtml(a.node)); }; BinderTest.prototype.testExpandEntityTag = function(){ assertEquals( - '<div ng-entity="Person" ng-watch="$anchor.a:1"></div>', - this.compileToHtml('<div ng-entity="Person" ng-watch="$anchor.a:1"/>')); + '<div ng-entity="Person" ng:watch="$anchor.a:1"></div>', + this.compileToHtml('<div ng-entity="Person" ng:watch="$anchor.a:1"/>')); }; BinderTest.prototype.testDoNotOverwriteCustomAction = function(){ @@ -233,7 +233,7 @@ BinderTest.prototype.testDoNotOverwriteCustomAction = function(){ }; BinderTest.prototype.testRepeaterAdd = function(){ - var c = this.compile('<div><input type="text" name="item.x" ng-repeat="item in items"></div>'); + var c = this.compile('<div><input type="text" name="item.x" ng:repeat="item in items"></div>'); var doc = c.node; c.scope.$set('items', [{x:'a'}, {x:'b'}]); c.scope.$eval(); @@ -248,7 +248,7 @@ BinderTest.prototype.testRepeaterAdd = function(){ }; BinderTest.prototype.testItShouldRemoveExtraChildrenWhenIteratingOverHash = function(){ - var c = this.compile('<div><div ng-repeat="i in items">{{i}}</div></div>'); + var c = this.compile('<div><div ng:repeat="i in items">{{i}}</div></div>'); var items = {}; c.scope.$set("items", items); @@ -308,8 +308,8 @@ BinderTest.prototype.testIfAttrBindingThrowsErrorDecorateTheAttribute = function }; BinderTest.prototype.testNestedRepeater = function() { - var a = this.compile('<div><div ng-repeat="m in model" name="{{m.name}}">' + - '<ul name="{{i}}" ng-repeat="i in m.item"></ul>' + + var a = this.compile('<div><div ng:repeat="m in model" name="{{m.name}}">' + + '<ul name="{{i}}" ng:repeat="i in m.item"></ul>' + '</div></div>'); a.scope.$set('model', [{name:'a', item:['a1', 'a2']}, {name:'b', item:['b1', 'b2']}]); @@ -317,20 +317,20 @@ BinderTest.prototype.testNestedRepeater = function() { assertEquals('<div>'+ '<#comment></#comment>'+ - '<div name="a" ng-bind-attr="{"name":"{{m.name}}"}" ng-repeat-index="0">'+ + '<div name="a" ng:bind-attr="{"name":"{{m.name}}"}" ng:repeat-index="0">'+ '<#comment></#comment>'+ - '<ul name="a1" ng-bind-attr="{"name":"{{i}}"}" ng-repeat-index="0"></ul>'+ - '<ul name="a2" ng-bind-attr="{"name":"{{i}}"}" ng-repeat-index="1"></ul>'+ + '<ul name="a1" ng:bind-attr="{"name":"{{i}}"}" ng:repeat-index="0"></ul>'+ + '<ul name="a2" ng:bind-attr="{"name":"{{i}}"}" ng:repeat-index="1"></ul>'+ '</div>'+ - '<div name="b" ng-bind-attr="{"name":"{{m.name}}"}" ng-repeat-index="1">'+ + '<div name="b" ng:bind-attr="{"name":"{{m.name}}"}" ng:repeat-index="1">'+ '<#comment></#comment>'+ - '<ul name="b1" ng-bind-attr="{"name":"{{i}}"}" ng-repeat-index="0"></ul>'+ - '<ul name="b2" ng-bind-attr="{"name":"{{i}}"}" ng-repeat-index="1"></ul>'+ + '<ul name="b1" ng:bind-attr="{"name":"{{i}}"}" ng:repeat-index="0"></ul>'+ + '<ul name="b2" ng:bind-attr="{"name":"{{i}}"}" ng:repeat-index="1"></ul>'+ '</div></div>', sortedHtml(a.node)); }; BinderTest.prototype.testHideBindingExpression = function() { - var a = this.compile('<div ng-hide="hidden == 3"/>'); + var a = this.compile('<div ng:hide="hidden == 3"/>'); a.scope.$set('hidden', 3); a.scope.$eval(); @@ -344,7 +344,7 @@ BinderTest.prototype.testHideBindingExpression = function() { }; BinderTest.prototype.testHideBinding = function() { - var c = this.compile('<div ng-hide="hidden"/>'); + var c = this.compile('<div ng:hide="hidden"/>'); c.scope.$set('hidden', 'true'); c.scope.$eval(); @@ -363,7 +363,7 @@ BinderTest.prototype.testHideBinding = function() { }; BinderTest.prototype.testShowBinding = function() { - var c = this.compile('<div ng-show="show"/>'); + var c = this.compile('<div ng:show="show"/>'); c.scope.$set('show', 'true'); c.scope.$eval(); @@ -382,42 +382,42 @@ BinderTest.prototype.testShowBinding = function() { }; BinderTest.prototype.testBindClassUndefined = function() { - var doc = this.compile('<div ng-class="undefined"/>'); + var doc = this.compile('<div ng:class="undefined"/>'); doc.scope.$eval(); assertEquals( - '<div class="undefined" ng-class="undefined"></div>', + '<div class="undefined" ng:class="undefined"></div>', sortedHtml(doc.node)); }; BinderTest.prototype.testBindClass = function() { - var c = this.compile('<div ng-class="class"/>'); + var c = this.compile('<div ng:class="class"/>'); c.scope.$set('class', 'testClass'); c.scope.$eval(); assertEquals(sortedHtml(c.node), - '<div class="testClass" ng-class="class"></div>'); + '<div class="testClass" ng:class="class"></div>'); c.scope.$set('class', ['a', 'b']); c.scope.$eval(); assertEquals(sortedHtml(c.node), - '<div class="a b" ng-class="class"></div>'); + '<div class="a b" ng:class="class"></div>'); }; BinderTest.prototype.testBindClassEvenOdd = function() { - var x = this.compile('<div><div ng-repeat="i in [0,1]" ng-class-even="\'e\'" ng-class-odd="\'o\'"/></div>'); + var x = this.compile('<div><div ng:repeat="i in [0,1]" ng:class-even="\'e\'" ng:class-odd="\'o\'"/></div>'); x.scope.$eval(); assertEquals( '<div><#comment></#comment>' + - '<div class="o" ng-class-even="\'e\'" ng-class-odd="\'o\'" ng-repeat-index="0"></div>' + - '<div class="e" ng-class-even="\'e\'" ng-class-odd="\'o\'" ng-repeat-index="1"></div></div>', + '<div class="o" ng:class-even="\'e\'" ng:class-odd="\'o\'" ng:repeat-index="0"></div>' + + '<div class="e" ng:class-even="\'e\'" ng:class-odd="\'o\'" ng:repeat-index="1"></div></div>', sortedHtml(x.node)); }; BinderTest.prototype.testBindStyle = function() { - var c = this.compile('<div ng-style="style"/>'); + var c = this.compile('<div ng:style="style"/>'); c.scope.$eval('style={color:"red"}'); c.scope.$eval(); @@ -430,7 +430,7 @@ BinderTest.prototype.testBindStyle = function() { BinderTest.prototype.testActionOnAHrefThrowsError = function(){ var model = {books:[]}; - var c = this.compile('<a ng-click="action()">Add Phone</a>', model); + var c = this.compile('<a ng:click="action()">Add Phone</a>', model); c.scope.action = function(){ throw {a:'abc', b:2}; }; @@ -450,23 +450,23 @@ BinderTest.prototype.testActionOnAHrefThrowsError = function(){ BinderTest.prototype.testShoulIgnoreVbNonBindable = function(){ var c = this.compile("<div>{{a}}" + - "<div ng-non-bindable>{{a}}</div>" + - "<div ng-non-bindable=''>{{b}}</div>" + - "<div ng-non-bindable='true'>{{c}}</div></div>"); + "<div ng:non-bindable>{{a}}</div>" + + "<div ng:non-bindable=''>{{b}}</div>" + + "<div ng:non-bindable='true'>{{c}}</div></div>"); c.scope.$set('a', 123); c.scope.$eval(); assertEquals('123{{a}}{{b}}{{c}}', c.node.text()); }; BinderTest.prototype.testOptionShouldUpdateParentToGetProperBinding = function() { - var c = this.compile('<select name="s"><option ng-repeat="i in [0,1]" value="{{i}}" ng-bind="i"></option></select>'); + var c = this.compile('<select name="s"><option ng:repeat="i in [0,1]" value="{{i}}" ng:bind="i"></option></select>'); c.scope.$set('s', 1); c.scope.$eval(); assertEquals(1, c.node[0].selectedIndex); }; BinderTest.prototype.testRepeaterShouldBindInputsDefaults = function () { - var c = this.compile('<div><input value="123" name="item.name" ng-repeat="item in items"></div>'); + var c = this.compile('<div><input value="123" name="item.name" ng:repeat="item in items"></div>'); c.scope.$set('items', [{}, {name:'misko'}]); c.scope.$eval(); @@ -475,7 +475,7 @@ BinderTest.prototype.testRepeaterShouldBindInputsDefaults = function () { }; BinderTest.prototype.testRepeaterShouldCreateArray = function () { - var c = this.compile('<input value="123" name="item.name" ng-repeat="item in items">'); + var c = this.compile('<input value="123" name="item.name" ng:repeat="item in items">'); c.scope.$eval(); assertEquals(0, c.scope.$get('items').length); @@ -486,7 +486,7 @@ BinderTest.prototype.testShouldTemplateBindPreElements = function () { c.scope.$set("name", "World"); c.scope.$eval(); - assertEquals('<pre ng-bind-template="Hello {{name}}!">Hello World!</pre>', sortedHtml(c.node)); + assertEquals('<pre ng:bind-template="Hello {{name}}!">Hello World!</pre>', sortedHtml(c.node)); }; BinderTest.prototype.testFillInOptionValueWhenMissing = function() { @@ -511,7 +511,7 @@ 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>'); + '<div ng:repeat="item in items"><input name="item.name" ng-required/></div></div>'); var items = [{}, {}]; c.scope.$set("items", items); c.scope.$eval(); @@ -539,7 +539,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(); @@ -552,9 +552,9 @@ BinderTest.prototype.testValidateOnlyVisibleItems = function(){ BinderTest.prototype.testDeleteAttributeIfEvaluatesFalse = function() { var c = this.compile('<div>' + - '<input name="a0" ng-bind-attr="{disabled:\'{{true}}\'}"><input name="a1" ng-bind-attr="{disabled:\'{{false}}\'}">' + - '<input name="b0" ng-bind-attr="{disabled:\'{{1}}\'}"><input name="b1" ng-bind-attr="{disabled:\'{{0}}\'}">' + - '<input name="c0" ng-bind-attr="{disabled:\'{{[0]}}\'}"><input name="c1" ng-bind-attr="{disabled:\'{{[]}}\'}"></div>'); + '<input name="a0" ng:bind-attr="{disabled:\'{{true}}\'}"><input name="a1" ng:bind-attr="{disabled:\'{{false}}\'}">' + + '<input name="b0" ng:bind-attr="{disabled:\'{{1}}\'}"><input name="b1" ng:bind-attr="{disabled:\'{{0}}\'}">' + + '<input name="c0" ng:bind-attr="{disabled:\'{{[0]}}\'}"><input name="c1" ng:bind-attr="{disabled:\'{{[]}}\'}"></div>'); c.scope.$eval(); function assertChild(index, disabled) { var child = childNode(c.node, index); @@ -571,8 +571,8 @@ BinderTest.prototype.testDeleteAttributeIfEvaluatesFalse = function() { BinderTest.prototype.testItShouldDisplayErrorWhenActionIsSyntacticlyIncorect = function(){ var c = this.compile('<div>' + - '<input type="button" ng-click="greeting=\'ABC\'"/>' + - '<input type="button" ng-click=":garbage:"/></div>'); + '<input type="button" ng:click="greeting=\'ABC\'"/>' + + '<input type="button" ng:click=":garbage:"/></div>'); var first = jqLite(c.node[0].childNodes[0]); var second = jqLite(c.node[0].childNodes[1]); @@ -605,8 +605,8 @@ BinderTest.prototype.testItShouldSelectTheCorrectRadioBox = function() { BinderTest.prototype.testItShouldListenOnRightScope = function() { var c = this.compile( - '<ul ng-init="counter=0; gCounter=0" ng-watch="w:counter=counter+1">' + - '<li ng-repeat="n in [1,2,4]" ng-watch="w:counter=counter+1;w:$root.gCounter=$root.gCounter+n"/></ul>'); + '<ul ng:init="counter=0; gCounter=0" ng:watch="w:counter=counter+1">' + + '<li ng:repeat="n in [1,2,4]" ng:watch="w:counter=counter+1;w:$root.gCounter=$root.gCounter+n"/></ul>'); c.scope.$eval(); assertEquals(0, c.scope.$get("counter")); assertEquals(0, c.scope.$get("gCounter")); @@ -618,25 +618,25 @@ BinderTest.prototype.testItShouldListenOnRightScope = function() { }; BinderTest.prototype.testItShouldRepeatOnHashes = function() { - var x = this.compile('<ul><li ng-repeat="(k,v) in {a:0,b:1}" ng-bind=\"k + v\"></li></ul>'); + var x = this.compile('<ul><li ng:repeat="(k,v) in {a:0,b:1}" ng:bind=\"k + v\"></li></ul>'); x.scope.$eval(); assertEquals('<ul>' + '<#comment></#comment>' + - '<li ng-bind=\"k + v\" ng-repeat-index="0">a0</li>' + - '<li ng-bind=\"k + v\" ng-repeat-index="1">b1</li>' + + '<li ng:bind=\"k + v\" ng:repeat-index="0">a0</li>' + + '<li ng:bind=\"k + v\" ng:repeat-index="1">b1</li>' + '</ul>', sortedHtml(x.node)); }; BinderTest.prototype.testItShouldFireChangeListenersBeforeUpdate = function(){ - var x = this.compile('<div ng-bind="name"></div>'); + var x = this.compile('<div ng:bind="name"></div>'); x.scope.$set("name", ""); x.scope.$watch("watched", "name=123"); x.scope.$set("watched", "change"); x.scope.$eval(); assertEquals(123, x.scope.$get("name")); assertEquals( - '<div ng-bind="name">123</div>', + '<div ng:bind="name">123</div>', sortedHtml(x.node)); }; @@ -657,7 +657,7 @@ BinderTest.prototype.XtestItShouldRenderMultiRootHtmlInBinding = function() { x.scope.a = "a<b>c</b>d"; x.scope.$eval(); assertEquals( - '<div>before <span ng-bind="a|html">a<b>c</b>d</span>after</div>', + '<div>before <span ng:bind="a|html">a<b>c</b>d</span>after</div>', sortedHtml(x.node)); }; diff --git a/test/ScenarioSpec.js b/test/ScenarioSpec.js index 9afe8e95..7ea3192d 100644 --- a/test/ScenarioSpec.js +++ b/test/ScenarioSpec.js @@ -1,6 +1,6 @@ describe("ScenarioSpec: Compilation", function(){ it("should compile dom node and return scope", function(){ - var node = jqLite('<div ng-init="a=1">{{b=a+1}}</div>')[0]; + var node = jqLite('<div ng:init="a=1">{{b=a+1}}</div>')[0]; var scope = compile(node); scope.$init(); expect(scope.a).toEqual(1); diff --git a/test/delete/WidgetsTest.js b/test/delete/WidgetsTest.js index 313d7372..9acc6126 100644 --- a/test/delete/WidgetsTest.js +++ b/test/delete/WidgetsTest.js @@ -111,7 +111,7 @@ RepeaterUpdaterTest.prototype.testShouldThrowInformativeSyntaxError= function(){ try { var repeater = new RepeaterUpdater(null, "a=b"); } catch (e) { - assertEquals("Expected ng-repeat in form of 'item in collection' but got 'a=b'.", e); + assertEquals("Expected ng:repeat in form of 'item in collection' but got 'a=b'.", e); } }; diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 42869a05..836c51e8 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -17,57 +17,57 @@ describe("directives", function(){ expect(size(jqCache)).toEqual(0); }); - it("should ng-init", function() { - var scope = compile('<div ng-init="a=123"></div>'); + it("should ng:init", function() { + var scope = compile('<div ng:init="a=123"></div>'); expect(scope.a).toEqual(123); }); - it("should ng-eval", function() { - var scope = compile('<div ng-init="a=0" ng-eval="a = a + 1"></div>'); + it("should ng:eval", function() { + var scope = compile('<div ng:init="a=0" ng:eval="a = a + 1"></div>'); expect(scope.a).toEqual(1); scope.$eval(); expect(scope.a).toEqual(2); }); - it('should ng-bind', function() { - var scope = compile('<div ng-bind="a"></div>'); + it('should ng:bind', function() { + var scope = compile('<div ng:bind="a"></div>'); expect(element.text()).toEqual(''); scope.a = 'misko'; scope.$eval(); expect(element.text()).toEqual('misko'); }); - it('should ng-bind html', function() { - var scope = compile('<div ng-bind="html|html"></div>'); + it('should ng:bind html', function() { + var scope = compile('<div ng:bind="html|html"></div>'); scope.html = '<div>hello</div>'; scope.$eval(); expect(lowercase(element.html())).toEqual('<div>hello</div>'); }); - it('should ng-bind element', function() { + it('should ng:bind element', function() { angularFilter.myElement = function() { return jqLite('<a>hello</a>'); }; - var scope = compile('<div ng-bind="0|myElement"></div>'); + var scope = compile('<div ng:bind="0|myElement"></div>'); scope.$eval(); expect(lowercase(element.html())).toEqual('<a>hello</a>'); }); - it('should ng-bind-template', function() { - var scope = compile('<div ng-bind-template="Hello {{name}}!"></div>'); + it('should ng:bind-template', function() { + var scope = compile('<div ng:bind-template="Hello {{name}}!"></div>'); scope.$set('name', 'Misko'); scope.$eval(); expect(element.text()).toEqual('Hello Misko!'); }); - it('should ng-bind-attr', function(){ - var scope = compile('<img ng-bind-attr="{src:\'http://localhost/mysrc\', alt:\'myalt\'}"/>'); + it('should ng:bind-attr', function(){ + var scope = compile('<img ng:bind-attr="{src:\'http://localhost/mysrc\', alt:\'myalt\'}"/>'); expect(element.attr('src')).toEqual('http://localhost/mysrc'); expect(element.attr('alt')).toEqual('myalt'); }); it('should remove special attributes on false', function(){ - var scope = compile('<input ng-bind-attr="{disabled:\'{{disabled}}\', readonly:\'{{readonly}}\', checked:\'{{checked}}\'}"/>'); + 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); @@ -83,15 +83,15 @@ describe("directives", function(){ expect(input.checked).toEqual(true); }); - it('should ng-non-bindable', function(){ - var scope = compile('<div ng-non-bindable><span ng-bind="name"></span></div>'); + it('should ng:non-bindable', function(){ + var scope = compile('<div ng:non-bindable><span ng:bind="name"></span></div>'); scope.$set('name', 'misko'); scope.$eval(); expect(element.text()).toEqual(''); }); - it('should ng-repeat over array', function(){ - var scope = compile('<ul><li ng-repeat="item in items" ng-init="suffix = \';\'" ng-bind="item + suffix"></li></ul>'); + it('should ng:repeat over array', function(){ + var scope = compile('<ul><li ng:repeat="item in items" ng:init="suffix = \';\'" ng:bind="item + suffix"></li></ul>'); scope.$set('items', ['misko', 'shyam']); scope.$eval(); @@ -106,28 +106,28 @@ describe("directives", function(){ expect(element.text()).toEqual('brad;'); }); - it('should ng-repeat over object', function(){ - var scope = compile('<ul><li ng-repeat="(key, value) in items" ng-bind="key + \':\' + value + \';\' "></li></ul>'); + it('should ng:repeat over object', function(){ + var scope = compile('<ul><li ng:repeat="(key, value) in items" ng:bind="key + \':\' + value + \';\' "></li></ul>'); scope.$set('items', {misko:'swe', shyam:'set'}); scope.$eval(); expect(element.text()).toEqual('misko:swe;shyam:set;'); }); - it('should set ng-repeat to [] if undefinde', function(){ - var scope = compile('<ul><li ng-repeat="item in items"></li></ul>'); + it('should set ng:repeat to [] if undefinde', function(){ + var scope = compile('<ul><li ng:repeat="item in items"></li></ul>'); expect(scope.items).toEqual([]); }); - it('should error on wrong parsing of ng-repeat', function(){ - var scope = compile('<ul><li ng-repeat="i dont parse"></li></ul>'); + it('should error on wrong parsing of ng:repeat', function(){ + var scope = compile('<ul><li ng:repeat="i dont parse"></li></ul>'); var log = ""; log += element.attr('ng-exception') + ';'; log += element.hasClass('ng-exception') + ';'; - expect(log).toEqual("\"Expected ng-repeat in form of 'item in collection' but got 'i dont parse'.\";true;"); + expect(log).toEqual("\"Expected ng:repeat in form of 'item in collection' but got 'i dont parse'.\";true;"); }); - it('should ng-watch', function(){ - var scope = compile('<div ng-watch="i: count = count + 1" ng-init="count = 0">'); + it('should ng:watch', function(){ + var scope = compile('<div ng:watch="i: count = count + 1" ng:init="count = 0">'); scope.$eval(); scope.$eval(); expect(scope.$get('count')).toEqual(0); @@ -138,8 +138,8 @@ describe("directives", function(){ expect(scope.$get('count')).toEqual(1); }); - it('should ng-click', function(){ - var scope = compile('<div ng-click="clicked = true"></div>'); + it('should ng:click', function(){ + var scope = compile('<div ng:click="clicked = true"></div>'); scope.$eval(); expect(scope.$get('clicked')).toBeFalsy(); @@ -147,16 +147,16 @@ describe("directives", function(){ expect(scope.$get('clicked')).toEqual(true); }); - it('should ng-class', function(){ - var scope = compile('<div class="existing" ng-class="[\'A\', \'B\']"></div>'); + it('should ng:class', function(){ + var scope = compile('<div class="existing" ng:class="[\'A\', \'B\']"></div>'); scope.$eval(); expect(element.hasClass('existing')).toBeTruthy(); expect(element.hasClass('A')).toBeTruthy(); expect(element.hasClass('B')).toBeTruthy(); }); - it('should ng-class odd/even', function(){ - var scope = compile('<ul><li ng-repeat="i in [0,1]" class="existing" ng-class-odd="\'odd\'" ng-class-even="\'even\'"></li><ul>'); + it('should ng:class odd/even', function(){ + var scope = compile('<ul><li ng:repeat="i in [0,1]" class="existing" ng:class-odd="\'odd\'" ng:class-even="\'even\'"></li><ul>'); scope.$eval(); var e1 = jqLite(element[0].childNodes[1]); var e2 = jqLite(element[0].childNodes[2]); @@ -166,14 +166,14 @@ describe("directives", function(){ expect(e2.hasClass('even')).toBeTruthy(); }); - it('should ng-style', function(){ - var scope = compile('<div ng-style="{color:\'red\'}"></div>'); + it('should ng:style', function(){ + var scope = compile('<div ng:style="{color:\'red\'}"></div>'); scope.$eval(); expect(element.css('color')).toEqual('red'); }); - it('should ng-show', function(){ - var scope = compile('<div ng-hide="hide"></div>'); + it('should ng:show', function(){ + var scope = compile('<div ng:hide="hide"></div>'); scope.$eval(); expect(isCssVisible(scope.$element)).toEqual(true); scope.$set('hide', true); @@ -181,8 +181,8 @@ describe("directives", function(){ expect(isCssVisible(scope.$element)).toEqual(false); }); - it('should ng-hide', function(){ - var scope = compile('<div ng-show="show"></div>'); + it('should ng:hide', function(){ + var scope = compile('<div ng:show="show"></div>'); scope.$eval(); expect(isCssVisible(scope.$element)).toEqual(false); scope.$set('show', true); @@ -190,7 +190,7 @@ describe("directives", function(){ expect(isCssVisible(scope.$element)).toEqual(true); }); - describe('ng-controller', function(){ + describe('ng:controller', function(){ it('should bind', function(){ window.Greeter = function(){ this.greeting = 'hello'; @@ -203,18 +203,18 @@ describe("directives", function(){ return this.greeting + ' ' + name + this.suffix; } }; - var scope = compile('<div ng-controller="Greeter"></div>'); + var scope = compile('<div ng:controller="Greeter"></div>'); expect(scope.greeting).toEqual('hello'); expect(scope.greet('misko')).toEqual('hello misko!'); window.Greeter = undefined; }); }); - it('should eval things according to ng-eval-order', function(){ + it('should eval things according to ng:eval-order', function(){ var scope = compile( - '<div ng-init="log=\'\'">' + + '<div ng:init="log=\'\'">' + '{{log = log + \'e\'}}' + - '<span ng-eval-order="first" ng-eval="log = log + \'a\'">' + + '<span ng:eval-order="first" ng:eval="log = log + \'a\'">' + '{{log = log + \'b\'}}' + '<span src="{{log = log + \'c\'}}"></span>' + '<span bind-template="{{log = log + \'d\'}}"></span>' + diff --git a/test/markupSpec.js b/test/markupSpec.js index 8358b673..5fe5bba9 100644 --- a/test/markupSpec.js +++ b/test/markupSpec.js @@ -20,23 +20,23 @@ describe("markups", function(){ it('should translate {{}} in text', function(){ compile('<div>hello {{name}}!</div>'); - expect(sortedHtml(element)).toEqual('<div>hello <span ng-bind="name"></span>!</div>'); + expect(sortedHtml(element)).toEqual('<div>hello <span ng:bind="name"></span>!</div>'); scope.$set('name', 'Misko'); scope.$eval(); - expect(sortedHtml(element)).toEqual('<div>hello <span ng-bind="name">Misko</span>!</div>'); + expect(sortedHtml(element)).toEqual('<div>hello <span ng:bind="name">Misko</span>!</div>'); }); it('should translate {{}} in terminal nodes', function(){ compile('<select name="x"><option value="">Greet {{name}}!</option></select>'); - expect(sortedHtml(element).replace(' selected="true"', '')).toEqual('<select name="x"><option ng-bind-template="Greet {{name}}!">Greet !</option></select>'); + expect(sortedHtml(element).replace(' selected="true"', '')).toEqual('<select name="x"><option ng:bind-template="Greet {{name}}!">Greet !</option></select>'); scope.$set('name', 'Misko'); scope.$eval(); - expect(sortedHtml(element).replace(' selected="true"', '')).toEqual('<select name="x"><option ng-bind-template="Greet {{name}}!">Greet Misko!</option></select>'); + expect(sortedHtml(element).replace(' selected="true"', '')).toEqual('<select name="x"><option ng:bind-template="Greet {{name}}!">Greet Misko!</option></select>'); }); it('should translate {{}} in attributes', function(){ compile('<img src="http://server/{{path}}.png"/>'); - expect(element.attr('ng-bind-attr')).toEqual('{"src":"http://server/{{path}}.png"}'); + expect(element.attr('ng:bind-attr')).toEqual('{"src":"http://server/{{path}}.png"}'); scope.$set('path', 'a/b'); scope.$eval(); expect(element.attr('src')).toEqual("http://server/a/b.png"); diff --git a/test/moveToAngularCom/miscTest.js b/test/moveToAngularCom/miscTest.js index aa0e1186..cc8f1c8c 100644 --- a/test/moveToAngularCom/miscTest.js +++ b/test/moveToAngularCom/miscTest.js @@ -1,7 +1,7 @@ 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>', + '<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")); @@ -10,7 +10,7 @@ BinderTest.prototype.testExpandEntityTagWithName = function(){ 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 ); + assertTrue(html, html.indexOf('ng:bind-attr="{"disabled":"{{$invalidWidgets}}"}"') > 0 ); }; BinderTest.prototype.testReplaceFileUploadWithSwf = function(){ @@ -29,7 +29,7 @@ BinderTest.prototype.testReplaceFileUploadWithSwf = function(){ BinderTest.prototype.testExpandEntityTagWithDefaults = function(){ assertEquals( - '<div ng-entity="Person:{a:\"a\"}" ng-watch=""></div>', + '<div ng-entity="Person:{a:\"a\"}" ng:watch=""></div>', this.compileToHtml('<div ng-entity=\'Person:{a:"a"}\'/>')); }; diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index d621b1f1..3020dfba 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -65,7 +65,7 @@ function sortedHtml(element) { var attrs = []; for(var i=0; i<attributes.length; i++) { var attr = attributes[i]; - if(attr.name.match(/^ng-/) || + if(attr.name.match(/^ng:/) || attr.value && attr.value !='null' && attr.value !='auto' && @@ -81,7 +81,7 @@ function sortedHtml(element) { attr.name !='style' && attr.name.substr(0, 6) != 'jQuery') { // in IE we need to check for all of these. - if (!/ng-\d+/.exec(attr.name)) + if (!/ng:\d+/.exec(attr.name)) attrs.push(' ' + attr.name + '="' + attr.value + '"'); } } diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index a053090e..158b24a8 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -22,7 +22,7 @@ describe("widget", function(){ describe("text", function(){ it('should input-text auto init and handle keyup/change events', function(){ - compile('<input type="Text" name="name" value="Misko" ng-change="count = count + 1" ng-init="count=0"/>'); + compile('<input type="Text" name="name" value="Misko" ng-change="count = count + 1" ng:init="count=0"/>'); expect(scope.$get('name')).toEqual("Misko"); expect(scope.$get('count')).toEqual(0); @@ -382,7 +382,7 @@ describe("widget", function(){ describe('ng:switch', function(){ it('should switch on value change', function(){ - compile('<ng:switch on="select"><div ng-switch-when="1">first:{{name}}</div><div ng-switch-when="2">second:{{name}}</div></ng:switch>'); + compile('<ng:switch on="select"><div ng:switch-when="1">first:{{name}}</div><div ng:switch-when="2">second:{{name}}</div></ng:switch>'); expect(element.html()).toEqual(''); scope.select = 1; scope.$eval(); @@ -399,7 +399,7 @@ describe("widget", function(){ }); it("should match urls", function(){ - var scope = angular.compile('<ng:switch on="url" using="route:params"><div ng-switch-when="/Book/:name">{{params.name}}</div></ng:switch>'); + var scope = angular.compile('<ng:switch on="url" using="route:params"><div ng:switch-when="/Book/:name">{{params.name}}</div></ng:switch>'); scope.url = '/Book/Moby'; scope.$init(); expect(scope.$element.text()).toEqual('Moby'); @@ -412,7 +412,7 @@ describe("widget", function(){ }); it('should call init on switch', function(){ - var scope = angular.compile('<ng:switch on="url" change="name=\'works\'"><div ng-switch-when="a">{{name}}</div></ng:switch>'); + var scope = angular.compile('<ng:switch on="url" change="name=\'works\'"><div ng:switch-when="a">{{name}}</div></ng:switch>'); var cleared = false; scope.url = 'a'; scope.$invalidWidgets = {clearOrphans: function(){ |
