mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-24 10:20:23 +00:00
change all attributes from ng- to ng: prefix
This commit is contained in:
parent
105e9443c4
commit
1f05621509
25 changed files with 260 additions and 255 deletions
|
|
@ -48,8 +48,8 @@
|
|||
<link rel="StyleSheet" type="text/css" href="../css/angular.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<input type="button" value="add" ng-click="add()"/>
|
||||
<input type="button" value="remove" ng-click="remove()"/>
|
||||
<input type="button" value="add" ng:click="add()"/>
|
||||
<input type="button" value="remove" ng:click="remove()"/>
|
||||
<div id="partial"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@
|
|||
<script type="text/javascript" src="../../src/angular-bootstrap.js"></script>
|
||||
<script type="text/javascript" src="tweeterclient.js"></script>
|
||||
</head>
|
||||
<body ng-class="status" ng-init="mute={}" ng-watch="$anchor.user: tweets = fetchTweets($anchor.user)">
|
||||
<body ng:class="status" ng:init="mute={}" ng:watch="$anchor.user: tweets = fetchTweets($anchor.user)">
|
||||
<div class="addressbook box">
|
||||
<h1>Address Book</h1>
|
||||
[ Filter: <input type="text" name="userFilter"/>]
|
||||
<ul>
|
||||
<li ng-repeat="user in users.$filter(userFilter).$orderBy('screen_name')" ng-class-even="'even'" ng-class-odd="'odd'">
|
||||
<a href="" ng-click="$anchor.user=user.screen_name"><img src="{{user.profile_image_url}}"/></a>
|
||||
<a href="" ng-click="$anchor.user=user.screen_name">{{user.screen_name}}</a>
|
||||
<li ng:repeat="user in users.$filter(userFilter).$orderBy('screen_name')" ng:class-even="'even'" ng:class-odd="'odd'">
|
||||
<a href="" ng:click="$anchor.user=user.screen_name"><img src="{{user.profile_image_url}}"/></a>
|
||||
<a href="" ng:click="$anchor.user=user.screen_name">{{user.screen_name}}</a>
|
||||
as <span class="nickname">{{user.name}}</span>
|
||||
[ <a href="#" ng-click="$anchor.edituser=user.screen_name">edit</a>
|
||||
| <a href="#" ng-click="users.$remove(user)">X</a>
|
||||
| <a href="#" ng-click="mute[user.screen_name] = ! mute[user.screen_name]">mute</a>
|
||||
[ <a href="#" ng:click="$anchor.edituser=user.screen_name">edit</a>
|
||||
| <a href="#" ng:click="users.$remove(user)">X</a>
|
||||
| <a href="#" ng:click="mute[user.screen_name] = ! mute[user.screen_name]">mute</a>
|
||||
]
|
||||
<div class="notes">{{user.notes|linky}}</div>
|
||||
<div class="clrleft"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
<div ng-show="$anchor.edituser" ng-eval="user = users.$find({:$.screen_name == $anchor.edituser})">
|
||||
<div ng:show="$anchor.edituser" ng:eval="user = users.$find({:$.screen_name == $anchor.edituser})">
|
||||
<div class="editor">
|
||||
<label>Username:</label>
|
||||
<input type="text" name="user.screen_name" disabled="disabled"/>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<label>Notes:</label>
|
||||
<textarea type="text" name="user.notes"></textarea>
|
||||
|
||||
<input type="button" ng-click="$anchor.edituser=undefined" value="Close"/>
|
||||
<input type="button" ng:click="$anchor.edituser=undefined" value="Close"/>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
|
@ -58,16 +58,16 @@ tweets={{tweets}}
|
|||
<div class="tweeter box">
|
||||
<h1>Tweets: {{$anchor.user}}</h1>
|
||||
[ Filter: <input type="text" name="tweetFilter"/>
|
||||
<span ng-show="$anchor.user">| <a href="#user="><< All</a></span>
|
||||
<span ng:show="$anchor.user">| <a href="#user="><< All</a></span>
|
||||
]
|
||||
<div class="loading">Loading...</div>
|
||||
<ul>
|
||||
<li ng-repeat="tweet in tweets.$filter(tweetFilter).$filter({:!mute[$.user.screen_name]})"
|
||||
ng-class-even="'even'" ng-class-odd="'odd'"
|
||||
ng-eval="user = users.$find({: $.screen_name == tweet.user.screen_name}) || tweet.user">
|
||||
<li ng:repeat="tweet in tweets.$filter(tweetFilter).$filter({:!mute[$.user.screen_name]})"
|
||||
ng:class-even="'even'" ng:class-odd="'odd'"
|
||||
ng:eval="user = users.$find({: $.screen_name == tweet.user.screen_name}) || tweet.user">
|
||||
<img src="{{user.profile_image_url}}"/>
|
||||
[ <a href="" ng-click="$anchor.user=user.screen_name">{{user.nickname || user.name || user.screen_name }}</a>
|
||||
| <a href="" ng-click="users.$includeIf(user, true)">+</a>
|
||||
[ <a href="" ng:click="$anchor.user=user.screen_name">{{user.nickname || user.name || user.screen_name }}</a>
|
||||
| <a href="" ng:click="users.$includeIf(user, true)">+</a>
|
||||
]:
|
||||
{{tweet.text | linky}}
|
||||
<span class="notes">{{tweet.created_at}}</span>
|
||||
|
|
|
|||
|
|
@ -8,19 +8,19 @@
|
|||
<script type="text/javascript" src="../../src/angular-bootstrap.js"></script>
|
||||
<script type="text/javascript" src="tweeterclient.js"></script>
|
||||
</head>
|
||||
<body ng-class="status" Xng-init="tweets = fetchTweets()">
|
||||
<body ng:class="status" Xng:init="tweets = fetchTweets()">
|
||||
(TODO: I should fetch current tweets)
|
||||
<div class="tweeter box">
|
||||
<h1>Tweets: {{$anchor.user}}</h1>
|
||||
[ Filter: <input type="text" name="tweetFilter"/> (TODO: this should act as search box)
|
||||
<span ng-show="$anchor.user">| <a href="#user="><< All</a></span>
|
||||
<span ng:show="$anchor.user">| <a href="#user="><< All</a></span>
|
||||
]
|
||||
<div class="loading">Loading...</div>
|
||||
<ul>
|
||||
<li Xng-repeat="tweet in tweets"
|
||||
ng-class-even="'even'" ng-class-odd="'odd'">
|
||||
<li Xng:repeat="tweet in tweets"
|
||||
ng:class-even="'even'" ng:class-odd="'odd'">
|
||||
<img src="{{tweet.user.profile_image_url}}"/>
|
||||
[ <a href="" Xng-click="$anchor.user=tweet.user.screen_name">{{tweet.user.nickname || tweet.user.name || tweet.user.screen_name }}</a>
|
||||
[ <a href="" Xng:click="$anchor.user=tweet.user.screen_name">{{tweet.user.nickname || tweet.user.name || tweet.user.screen_name }}</a>
|
||||
]:
|
||||
{{tweet.text}} (TODO: I want urls as links)
|
||||
<span class="notes">{{tweet.created_at}}</span>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div ng-controller="AccountController">
|
||||
<div ng:controller="AccountController">
|
||||
account page goes here!
|
||||
<input type="text" name="name" value="misko"/>
|
||||
<button ng-click="hello()">hello</button>
|
||||
<button ng:click="hello()">hello</button>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@
|
|||
|
||||
</script>
|
||||
</head>
|
||||
<body ng-init="$window.$scope = this">
|
||||
<body ng:init="$window.$scope = this">
|
||||
[ <a href="#login">login</a>
|
||||
| <a href="#account">account</a>
|
||||
]
|
||||
|
||||
<ng:switch on="$location.hashPath">
|
||||
<div ng-switch-when="login">login screen</div>
|
||||
<ng:include ng-switch-when="account" src="'application-account.html'"></ng:include>
|
||||
<div ng:switch-when="login">login screen</div>
|
||||
<ng:include ng:switch-when="account" src="'application-account.html'"></ng:include>
|
||||
</ng:switch>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<script type="text/javascript" src="../../src/angular-bootstrap.js#autobind"></script>
|
||||
</head>
|
||||
<body ng:init="$window.$scope = this; People = $resource('People.json')">
|
||||
<button ng-click="people = People.query()">Load People</button>
|
||||
<button ng:click="people = People.query()">Load People</button>
|
||||
<pre>people = {{people}}</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
$(document).ready(function(){angular.compile(document).init();});
|
||||
</script>
|
||||
</head>
|
||||
<body ng-entity="book=Book" ng-init="books=Book.all()">
|
||||
<body ng-entity="book=Book" ng:init="books=Book.all()">
|
||||
<p>{{book.$id}}</p>
|
||||
<li ng-repeat="book in books.$orderBy('name')">
|
||||
<li ng:repeat="book in books.$orderBy('name')">
|
||||
<li>{{book.name}}</li>
|
||||
</li>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
};
|
||||
</script>
|
||||
</head>
|
||||
<body ng:init="$window.$scope = this; items = createItems()" ng-controller="PerfCntl">
|
||||
<body ng:init="$window.$scope = this; items = createItems()" ng:controller="PerfCntl">
|
||||
<input type="text" name="text"/>
|
||||
<hr/>
|
||||
<ul>
|
||||
<li Xng-repeat="item in items.$filter('').$orderBy('name')"
|
||||
ng-repeat="item in items">
|
||||
<li Xng:repeat="item in items.$filter('').$orderBy('name')"
|
||||
ng:repeat="item in items">
|
||||
{{item.name}} <a href="#{{item.name}}">{{item.parts.join(', ')}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
</tr>
|
||||
<tr><th colspan="3">Buttons</th></tr>
|
||||
<tr>
|
||||
<td>ng-change<br/>ng-click</td>
|
||||
<td>ng-change<br/>ng:click</td>
|
||||
<td ng:init="button.count = 0">
|
||||
<form>
|
||||
<input type="button" value="button" ng-change="button.count = button.count + 1"/> <br/>
|
||||
|
|
@ -85,10 +85,10 @@
|
|||
</tr>
|
||||
<tr><th colspan="3">Repeaters</th></tr>
|
||||
<tr>
|
||||
<td>ng-repeat</td>
|
||||
<td>ng:repeat</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li ng-repeat="name in ['misko', 'adam']">{{name}}</li>
|
||||
<li ng:repeat="name in ['misko', 'adam']">{{name}}</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td></td>
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ Compiler.prototype = {
|
|||
descend: function(value){ if(isDefined(value)) descend = value; return descend;},
|
||||
directives: function(value){ if(isDefined(value)) directives = value; return directives;}
|
||||
};
|
||||
priority = element.attr('ng-eval-order') || priority || 0;
|
||||
priority = element.attr('ng:eval-order') || priority || 0;
|
||||
if (isString(priority)) {
|
||||
priority = PRIORITY[uppercase(priority)] || 0;
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ function eachAttribute(element, fn){
|
|||
var i, attrs = element[0].attributes || [], chld, attr, name, value, attrValue = {};
|
||||
for (i = 0; i < attrs.length; i++) {
|
||||
attr = attrs[i];
|
||||
name = attr.name.replace(':', '-');
|
||||
name = attr.name;
|
||||
value = attr.value;
|
||||
if (msie && name == 'href') {
|
||||
value = decodeURIComponent(element[0].getAttribute(name, 2));
|
||||
|
|
|
|||
|
|
@ -112,24 +112,24 @@ Binder.prototype = {
|
|||
},
|
||||
|
||||
executeInit: function() {
|
||||
this.docFindWithSelf("[ng-init]").each(function() {
|
||||
this.docFindWithSelf("[ng:init]").each(function() {
|
||||
var jThis = jQuery(this);
|
||||
var scope = jThis.scope();
|
||||
try {
|
||||
scope.eval(jThis.attr('ng-init'));
|
||||
scope.eval(jThis.attr('ng:init'));
|
||||
} catch (e) {
|
||||
alert("EVAL ERROR:\n" + jThis.attr('ng-init') + '\n' + toJson(e, true));
|
||||
alert("EVAL ERROR:\n" + jThis.attr('ng:init') + '\n' + toJson(e, true));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
entity: function (scope) {
|
||||
var self = this;
|
||||
this.docFindWithSelf("[ng-entity]").attr("ng-watch", function() {
|
||||
this.docFindWithSelf("[ng-entity]").attr("ng:watch", function() {
|
||||
try {
|
||||
var jNode = jQuery(this);
|
||||
var decl = scope.entity(jNode.attr("ng-entity"), self.datastore);
|
||||
return decl + (jNode.attr('ng-watch') || "");
|
||||
return decl + (jNode.attr('ng:watch') || "");
|
||||
} catch (e) {
|
||||
log(e);
|
||||
alert(e);
|
||||
|
|
@ -142,7 +142,7 @@ Binder.prototype = {
|
|||
if (this.config['autoSubmit']) {
|
||||
var submits = this.docFindWithSelf(":submit").not("[ng-action]");
|
||||
submits.attr("ng-action", "$save()");
|
||||
submits.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr", '{disabled:"{{$invalidWidgets}}"}');
|
||||
submits.not(":disabled").not("ng:bind-attr").attr("ng:bind-attr", '{disabled:"{{$invalidWidgets}}"}');
|
||||
}
|
||||
this.precompile(this.doc)(this.doc, jNode.scope(), "");
|
||||
this.docFindWithSelf("a[ng-action]").live('click', function (event) {
|
||||
|
|
@ -168,9 +168,9 @@ Binder.prototype = {
|
|||
if (parts.length > 1 || Binder.binding(parts[0])) {
|
||||
var parent = node.parentNode;
|
||||
if (isLeafNode(parent)) {
|
||||
parent.setAttribute('ng-bind-template', node.nodeValue);
|
||||
parent.setAttribute('ng:bind-template', node.nodeValue);
|
||||
factories.push({path:path, fn:function(node, scope, prefix) {
|
||||
return new BindUpdater(node, node.getAttribute('ng-bind-template'));
|
||||
return new BindUpdater(node, node.getAttribute('ng:bind-template'));
|
||||
}});
|
||||
} else {
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
|
|
@ -180,7 +180,7 @@ Binder.prototype = {
|
|||
if (binding) {
|
||||
newNode = document.createElement("span");
|
||||
var jNewNode = jQuery(newNode);
|
||||
jNewNode.attr("ng-bind", binding);
|
||||
jNewNode.attr("ng:bind", binding);
|
||||
if (i === 0) {
|
||||
factories.push({path:path.concat(offset + i), fn:this.ng_bind});
|
||||
}
|
||||
|
|
@ -228,13 +228,13 @@ Binder.prototype = {
|
|||
}
|
||||
|
||||
if (!node.getAttribute) return;
|
||||
var nonBindable = node.getAttribute('ng-non-bindable');
|
||||
var nonBindable = node.getAttribute('ng:non-bindable');
|
||||
if (nonBindable || nonBindable === "") return;
|
||||
|
||||
var attributes = node.attributes;
|
||||
if (attributes) {
|
||||
var bindings = node.getAttribute('ng-bind-attr');
|
||||
node.removeAttribute('ng-bind-attr');
|
||||
var bindings = node.getAttribute('ng:bind-attr');
|
||||
node.removeAttribute('ng:bind-attr');
|
||||
bindings = bindings ? fromJson(bindings) : {};
|
||||
var attrLen = attributes.length;
|
||||
for (var i = 0; i < attrLen; i++) {
|
||||
|
|
@ -249,23 +249,23 @@ Binder.prototype = {
|
|||
}
|
||||
var json = toJson(bindings);
|
||||
if (json.length > 2) {
|
||||
node.setAttribute("ng-bind-attr", json);
|
||||
node.setAttribute("ng:bind-attr", json);
|
||||
}
|
||||
}
|
||||
|
||||
if (!node.getAttribute) log(node);
|
||||
var repeaterExpression = node.getAttribute('ng-repeat');
|
||||
var repeaterExpression = node.getAttribute('ng:repeat');
|
||||
if (repeaterExpression) {
|
||||
node.removeAttribute('ng-repeat');
|
||||
node.removeAttribute('ng:repeat');
|
||||
var precompiled = this.precompile(node);
|
||||
var view = document.createComment("ng-repeat: " + repeaterExpression);
|
||||
var view = document.createComment("ng:repeat: " + repeaterExpression);
|
||||
var parentNode = node.parentNode;
|
||||
parentNode.insertBefore(view, node);
|
||||
parentNode.removeChild(node);
|
||||
function template(childScope, prefix, i) {
|
||||
var clone = jQuery(node).clone();
|
||||
clone.css('display', '');
|
||||
clone.attr('ng-repeat-index', "" + i);
|
||||
clone.attr('ng:repeat-index', "" + i);
|
||||
clone.data('scope', childScope);
|
||||
precompiled(clone[0], childScope, prefix + i + ":");
|
||||
return clone;
|
||||
|
|
@ -276,16 +276,16 @@ Binder.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (node.getAttribute('ng-eval')) factories.push({path:path, fn:this.ng_eval});
|
||||
if (node.getAttribute('ng-bind')) factories.push({path:path, fn:this.ng_bind});
|
||||
if (node.getAttribute('ng-bind-attr')) factories.push({path:path, fn:this.ng_bind_attr});
|
||||
if (node.getAttribute('ng-hide')) factories.push({path:path, fn:this.ng_hide});
|
||||
if (node.getAttribute('ng-show')) factories.push({path:path, fn:this.ng_show});
|
||||
if (node.getAttribute('ng-class')) factories.push({path:path, fn:this.ng_class});
|
||||
if (node.getAttribute('ng-class-odd')) factories.push({path:path, fn:this.ng_class_odd});
|
||||
if (node.getAttribute('ng-class-even')) factories.push({path:path, fn:this.ng_class_even});
|
||||
if (node.getAttribute('ng-style')) factories.push({path:path, fn:this.ng_style});
|
||||
if (node.getAttribute('ng-watch')) factories.push({path:path, fn:this.ng_watch});
|
||||
if (node.getAttribute('ng:eval')) factories.push({path:path, fn:this.ng_eval});
|
||||
if (node.getAttribute('ng:bind')) factories.push({path:path, fn:this.ng_bind});
|
||||
if (node.getAttribute('ng:bind-attr')) factories.push({path:path, fn:this.ng_bind_attr});
|
||||
if (node.getAttribute('ng:hide')) factories.push({path:path, fn:this.ng_hide});
|
||||
if (node.getAttribute('ng:show')) factories.push({path:path, fn:this.ng_show});
|
||||
if (node.getAttribute('ng:class')) factories.push({path:path, fn:this.ng_class});
|
||||
if (node.getAttribute('ng:class-odd')) factories.push({path:path, fn:this.ng_class_odd});
|
||||
if (node.getAttribute('ng:class-even')) factories.push({path:path, fn:this.ng_class_even});
|
||||
if (node.getAttribute('ng:style')) factories.push({path:path, fn:this.ng_style});
|
||||
if (node.getAttribute('ng:watch')) factories.push({path:path, fn:this.ng_watch});
|
||||
var nodeName = node.nodeName;
|
||||
if ((nodeName == 'INPUT' ) ||
|
||||
nodeName == 'TEXTAREA' ||
|
||||
|
|
@ -301,7 +301,7 @@ Binder.prototype = {
|
|||
var html = jQuery('<select/>').append(jQuery(node).clone()).html();
|
||||
if (!html.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)) {
|
||||
if (Binder.hasBinding(node.text)) {
|
||||
jQuery(node).attr('ng-bind-attr', angular.toJson({'value':node.text}));
|
||||
jQuery(node).attr('ng:bind-attr', angular.toJson({'value':node.text}));
|
||||
} else {
|
||||
node.value = node.text;
|
||||
}
|
||||
|
|
@ -315,42 +315,42 @@ Binder.prototype = {
|
|||
},
|
||||
|
||||
ng_eval: function(node) {
|
||||
return new EvalUpdater(node, node.getAttribute('ng-eval'));
|
||||
return new EvalUpdater(node, node.getAttribute('ng:eval'));
|
||||
},
|
||||
|
||||
ng_bind: function(node) {
|
||||
return new BindUpdater(node, "{{" + node.getAttribute('ng-bind') + "}}");
|
||||
return new BindUpdater(node, "{{" + node.getAttribute('ng:bind') + "}}");
|
||||
},
|
||||
|
||||
ng_bind_attr: function(node) {
|
||||
return new BindAttrUpdater(node, fromJson(node.getAttribute('ng-bind-attr')));
|
||||
return new BindAttrUpdater(node, fromJson(node.getAttribute('ng:bind-attr')));
|
||||
},
|
||||
|
||||
ng_hide: function(node) {
|
||||
return new HideUpdater(node, node.getAttribute('ng-hide'));
|
||||
return new HideUpdater(node, node.getAttribute('ng:hide'));
|
||||
},
|
||||
|
||||
ng_show: function(node) {
|
||||
return new ShowUpdater(node, node.getAttribute('ng-show'));
|
||||
return new ShowUpdater(node, node.getAttribute('ng:show'));
|
||||
},
|
||||
|
||||
ng_class: function(node) {
|
||||
return new ClassUpdater(node, node.getAttribute('ng-class'));
|
||||
return new ClassUpdater(node, node.getAttribute('ng:class'));
|
||||
},
|
||||
|
||||
ng_class_even: function(node) {
|
||||
return new ClassEvenUpdater(node, node.getAttribute('ng-class-even'));
|
||||
return new ClassEvenUpdater(node, node.getAttribute('ng:class-even'));
|
||||
},
|
||||
|
||||
ng_class_odd: function(node) {
|
||||
return new ClassOddUpdater(node, node.getAttribute('ng-class-odd'));
|
||||
return new ClassOddUpdater(node, node.getAttribute('ng:class-odd'));
|
||||
},
|
||||
|
||||
ng_style: function(node) {
|
||||
return new StyleUpdater(node, node.getAttribute('ng-style'));
|
||||
return new StyleUpdater(node, node.getAttribute('ng:style'));
|
||||
},
|
||||
|
||||
ng_watch: function(node, scope) {
|
||||
scope.watch(node.getAttribute('ng-watch'));
|
||||
scope.watch(node.getAttribute('ng:watch'));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ angularCallbacks['flashEvent'] = function(id, event, args) {
|
|||
|
||||
FileController.template = function(id) {
|
||||
return jQuery('<span class="ng-upload-widget">' +
|
||||
'<input type="checkbox" ng-non-bindable="true"/>' +
|
||||
'<input type="checkbox" ng:non-bindable="true"/>' +
|
||||
'<object id="' + id + '" />' +
|
||||
'<a></a>' +
|
||||
'<span/>' +
|
||||
|
|
@ -640,7 +640,7 @@ function RepeaterUpdater(view, repeaterExpression, template, prefix) {
|
|||
this.children = [];
|
||||
var match = repeaterExpression.match(/^\s*(.+)\s+in\s+(.*)\s*$/);
|
||||
if (! match) {
|
||||
throw "Expected ng-repeat in form of 'item in collection' but got '" +
|
||||
throw "Expected ng:repeat in form of 'item in collection' but got '" +
|
||||
repeaterExpression + "'.";
|
||||
}
|
||||
var keyValue = match[1];
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
angularDirective("ng-init", function(expression){
|
||||
angularDirective("ng:init", function(expression){
|
||||
return function(element){
|
||||
this.$tryEval(expression, element);
|
||||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-controller", function(expression){
|
||||
angularDirective("ng:controller", function(expression){
|
||||
return function(element){
|
||||
var controller = getter(window, expression, true) || getter(this, expression, true);
|
||||
if (!controller)
|
||||
|
|
@ -16,13 +16,13 @@ angularDirective("ng-controller", function(expression){
|
|||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-eval", function(expression){
|
||||
angularDirective("ng:eval", function(expression){
|
||||
return function(element){
|
||||
this.$onEval(expression, element);
|
||||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-bind", function(expression){
|
||||
angularDirective("ng:bind", function(expression){
|
||||
return function(element) {
|
||||
var lastValue = noop, lastError = noop;
|
||||
this.$onEval(function() {
|
||||
|
|
@ -89,7 +89,7 @@ function compileBindTemplate(template){
|
|||
return fn;
|
||||
}
|
||||
|
||||
angularDirective("ng-bind-template", function(expression){
|
||||
angularDirective("ng:bind-template", function(expression){
|
||||
var templateFn = compileBindTemplate(expression);
|
||||
return function(element) {
|
||||
var lastValue;
|
||||
|
|
@ -108,7 +108,7 @@ var REMOVE_ATTRIBUTES = {
|
|||
'readonly':'readOnly',
|
||||
'checked':'checked'
|
||||
};
|
||||
angularDirective("ng-bind-attr", function(expression){
|
||||
angularDirective("ng:bind-attr", function(expression){
|
||||
return function(element){
|
||||
var lastValue = {};
|
||||
this.$onEval(function(){
|
||||
|
|
@ -134,17 +134,17 @@ angularDirective("ng-bind-attr", function(expression){
|
|||
};
|
||||
});
|
||||
|
||||
angularWidget("@ng-non-bindable", noop);
|
||||
angularWidget("@ng:non-bindable", noop);
|
||||
|
||||
angularWidget("@ng-repeat", function(expression, element){
|
||||
element.removeAttr('ng-repeat');
|
||||
element.replaceWith(this.comment("ng-repeat: " + expression));
|
||||
angularWidget("@ng:repeat", function(expression, element){
|
||||
element.removeAttr('ng:repeat');
|
||||
element.replaceWith(this.comment("ng:repeat: " + expression));
|
||||
var template = this.compile(element);
|
||||
return function(reference){
|
||||
var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/),
|
||||
lhs, rhs, valueIdent, keyIdent;
|
||||
if (! match) {
|
||||
throw "Expected ng-repeat in form of 'item in collection' but got '" +
|
||||
throw "Expected ng:repeat in form of 'item in collection' but got '" +
|
||||
expression + "'.";
|
||||
}
|
||||
lhs = match[1];
|
||||
|
|
@ -176,7 +176,7 @@ angularWidget("@ng-repeat", function(expression, element){
|
|||
if (keyIdent) childScope[keyIdent] = key;
|
||||
lastElement.after(childScope.$element);
|
||||
childScope.$index = index;
|
||||
childScope.$element.attr('ng-repeat-index', index);
|
||||
childScope.$element.attr('ng:repeat-index', index);
|
||||
childScope.$init();
|
||||
children.push(childScope);
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ angularWidget("@ng-repeat", function(expression, element){
|
|||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-click", function(expression, element){
|
||||
angularDirective("ng:click", function(expression, element){
|
||||
return function(element){
|
||||
var self = this;
|
||||
element.bind('click', function(){
|
||||
|
|
@ -203,7 +203,7 @@ angularDirective("ng-click", function(expression, element){
|
|||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-watch", function(expression, element){
|
||||
angularDirective("ng:watch", function(expression, element){
|
||||
return function(element){
|
||||
var self = this;
|
||||
new Parser(expression).watch()({
|
||||
|
|
@ -231,11 +231,11 @@ function ngClass(selector) {
|
|||
};
|
||||
}
|
||||
|
||||
angularDirective("ng-class", ngClass(function(){return true;}));
|
||||
angularDirective("ng-class-odd", ngClass(function(i){return i % 2 === 0;}));
|
||||
angularDirective("ng-class-even", ngClass(function(i){return i % 2 === 1;}));
|
||||
angularDirective("ng:class", ngClass(function(){return true;}));
|
||||
angularDirective("ng:class-odd", ngClass(function(i){return i % 2 === 0;}));
|
||||
angularDirective("ng:class-even", ngClass(function(i){return i % 2 === 1;}));
|
||||
|
||||
angularDirective("ng-show", function(expression, element){
|
||||
angularDirective("ng:show", function(expression, element){
|
||||
return function(element){
|
||||
this.$onEval(function(){
|
||||
element.css('display', toBoolean(this.$eval(expression)) ? '' : 'none');
|
||||
|
|
@ -243,7 +243,7 @@ angularDirective("ng-show", function(expression, element){
|
|||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-hide", function(expression, element){
|
||||
angularDirective("ng:hide", function(expression, element){
|
||||
return function(element){
|
||||
this.$onEval(function(){
|
||||
element.css('display', toBoolean(this.$eval(expression)) ? 'none' : '');
|
||||
|
|
@ -251,7 +251,7 @@ angularDirective("ng-hide", function(expression, element){
|
|||
};
|
||||
});
|
||||
|
||||
angularDirective("ng-style", function(expression, element){
|
||||
angularDirective("ng:style", function(expression, element){
|
||||
return function(element){
|
||||
this.$onEval(function(){
|
||||
element.css(this.$eval(expression));
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {
|
|||
self = this;
|
||||
if (hasBindings(bindings)) {
|
||||
if (isLeafNode(parentElement[0])) {
|
||||
parentElement.attr('ng-bind-template', text);
|
||||
parentElement.attr('ng:bind-template', text);
|
||||
} else {
|
||||
var cursor = textNode, newElement;
|
||||
foreach(parseBindings(text), function(text){
|
||||
var exp = binding(text);
|
||||
if (exp) {
|
||||
newElement = self.element('span');
|
||||
newElement.attr('ng-bind', exp);
|
||||
newElement.attr('ng:bind', exp);
|
||||
} else {
|
||||
newElement = self.text(text);
|
||||
}
|
||||
|
|
@ -68,18 +68,18 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
|
|||
}
|
||||
});
|
||||
|
||||
var NG_BIND_ATTR = 'ng-bind-attr';
|
||||
var NG_BIND_ATTR = 'ng:bind-attr';
|
||||
angularAttrMarkup('{{}}', function(value, name, element){
|
||||
if (name.substr(0, 3) != 'ng-') {
|
||||
if (msie && name == 'src')
|
||||
value = decodeURI(value);
|
||||
var bindings = parseBindings(value),
|
||||
bindAttr;
|
||||
if (hasBindings(bindings)) {
|
||||
element.removeAttr(name);
|
||||
bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}");
|
||||
bindAttr[name] = value;
|
||||
element.attr(NG_BIND_ATTR, toJson(bindAttr));
|
||||
}
|
||||
// don't process existing attribute markup
|
||||
if (angularDirective(name) || angularDirective("@" + name)) return;
|
||||
if (msie && name == 'src')
|
||||
value = decodeURI(value);
|
||||
var bindings = parseBindings(value),
|
||||
bindAttr;
|
||||
if (hasBindings(bindings)) {
|
||||
element.removeAttr(name);
|
||||
bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}");
|
||||
bindAttr[name] = value;
|
||||
element.attr(NG_BIND_ATTR, toJson(bindAttr));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ function ControlBar(document, serverUrl, database) {
|
|||
ControlBar.HTML =
|
||||
'<div>' +
|
||||
'<div class="ui-widget-overlay"></div>' +
|
||||
'<div id="ng-login" ng-non-bindable="true">' +
|
||||
'<div id="ng-login" ng:non-bindable="true">' +
|
||||
'<div class="ng-login-container"></div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
|
||||
ControlBar.FORBIDEN =
|
||||
'<div ng-non-bindable="true" title="Permission Error:">' +
|
||||
'<div ng:non-bindable="true" title="Permission Error:">' +
|
||||
'Sorry, you do not have permission for this!'+
|
||||
'</div>';
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ function inputWidget(events, modelAccessor, viewAccessor, initFn) {
|
|||
action = element.attr('ng-change') || '',
|
||||
lastValue;
|
||||
initFn.call(scope, model, view, element);
|
||||
this.$eval(element.attr('ng-init')||'');
|
||||
this.$eval(element.attr('ng:init')||'');
|
||||
// Don't register a handler if we are a button (noopAccessor) and there is no action
|
||||
if (action || modelAccessor !== noopAccessor) {
|
||||
element.bind(events, function(){
|
||||
|
|
@ -236,11 +236,11 @@ angularWidget('NG:INCLUDE', function(element){
|
|||
var compiler = this,
|
||||
srcExp = element.attr("src"),
|
||||
scopeExp = element.attr("scope") || '';
|
||||
if (element[0]['ng-compiled']) {
|
||||
if (element[0]['ng:compiled']) {
|
||||
this.descend(true);
|
||||
this.directives(true);
|
||||
} else {
|
||||
element[0]['ng-compiled'] = true;
|
||||
element[0]['ng:compiled'] = true;
|
||||
return function(element){
|
||||
var scope = this, childScope;
|
||||
var changeCounter = 0;
|
||||
|
|
@ -276,7 +276,7 @@ var ngSwitch = angularWidget('NG:SWITCH', function (element){
|
|||
cases = [];
|
||||
if (!usingFn) throw "Using expression '" + usingExpr + "' unknown.";
|
||||
eachNode(element, function(caseElement){
|
||||
var when = caseElement.attr('ng-switch-when');
|
||||
var when = caseElement.attr('ng:switch-when');
|
||||
if (when) {
|
||||
cases.push({
|
||||
when: function(scope, value){
|
||||
|
|
|
|||
9
test.sh
9
test.sh
|
|
@ -1,2 +1,7 @@
|
|||
java -jar lib/jstestdriver/JsTestDriver.jar --tests all
|
||||
# java -jar lib/jstestdriver/JsTestDriver.jar --tests all --config jsTestDriver-jquery.conf
|
||||
tests=$1
|
||||
if [[ $tests = "" ]]; then
|
||||
tests="all"
|
||||
fi
|
||||
|
||||
java -jar lib/jstestdriver/JsTestDriver.jar --tests "$tests"
|
||||
# java -jar lib/jstestdriver/JsTestDriver.jar --tests "$tests" --config jsTestDriver-jquery.conf
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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>' +
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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"}\'/>'));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 + '"');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue