From c9705b755645a4bfe066243f2ba15a733c3787e1 Mon Sep 17 00:00:00 2001
From: Gias Kay Lee
Date: Fri, 3 Jan 2014 00:22:10 +0800
Subject: fix(ngRepeat): allow for more flexible coding style in ngRepeat
expression
With this change it's possible to split the ng-repeat expression into multiple
lines at any point in the expression where white-space is expected.
Closes #5537
Closes #5598
---
test/ng/directive/ngRepeatSpec.js | 48 ++++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 16 deletions(-)
(limited to 'test/ng/directive')
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js
index 2d70d4a4..638f082c 100644
--- a/test/ng/directive/ngRepeatSpec.js
+++ b/test/ng/directive/ngRepeatSpec.js
@@ -177,22 +177,6 @@ describe('ngRepeat', function() {
});
- it('should allow expressions over multiple lines', function() {
- scope.isTrue = function() {
- return true;
- };
- element = $compile(
- '
' +
- '- {{item.name}}
' +
- '
')(scope);
- scope.items = [{name: 'igor'}];
- scope.$digest();
-
- expect(element.find('li').text()).toBe('igor');
- });
-
-
it('should track using provided function when a filter is present', function() {
scope.newArray = function (items) {
var newArray = [];
@@ -354,6 +338,38 @@ describe('ngRepeat', function() {
});
+ it('should allow expressions over multiple lines', function() {
+ element = $compile(
+ '' +
+ '- {{item.name}}/
' +
+ '
')(scope);
+
+ scope.isTrue = function() {return true;};
+ scope.items = [{name: 'igor'}, {name: 'misko'}];
+
+ scope.$digest();
+
+ expect(element.text()).toEqual('igor/misko/');
+ });
+
+
+ it('should strip white space characters correctly', function() {
+ element = $compile(
+ '' +
+ '- {{item.name}}/
' +
+ '
')(scope);
+
+ scope.items = [{name: 'igor'}, {name: 'misko'}];
+
+ scope.$digest();
+
+ expect(element.text()).toEqual('misko/');
+ });
+
+
it('should not ngRepeat over parent properties', function() {
var Class = function() {};
Class.prototype.abc = function() {};
--
cgit v1.2.3