You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by mi...@apache.org on 2015/05/22 19:02:20 UTC

[08/10] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34852 Alex H rightly pointed out that there can be objects with fields that contain "." in them. So I added a unit test to cater for this scenario, which changes the way this feature can be imple

FLEX-34852
Alex H rightly pointed out that there can be objects with fields that contain "." in them. So I added a unit test to cater for this scenario, which changes the way this feature can be implemented.


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/ee4da994
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/ee4da994
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/ee4da994

Branch: refs/heads/develop
Commit: ee4da9942cac2185455ea2bfef70647544890b7b
Parents: 04aa9e6
Author: Mihai Chira <mi...@apache.org>
Authored: Fri May 22 17:34:08 2015 +0200
Committer: Mihai Chira <mi...@apache.org>
Committed: Fri May 22 18:21:11 2015 +0200

----------------------------------------------------------------------
 .../tests/ListCollectionView_Sort_Tests.as      | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/ee4da994/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as b/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
index 3aed1a6..0a4b6f6 100644
--- a/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
+++ b/frameworks/projects/framework/tests/ListCollectionView_Sort_Tests.as
@@ -309,6 +309,33 @@ package {
             assertRemoveAll();
         }
 
+        [Test]
+        public function test_simple_numeric_ascending_sort_on_complex_objects_with_dot_in_property_name():void
+        {
+            //given
+            var from4To0:IList = generateVOs(5, true);
+
+            const fieldName:String = "property.with.dot";
+            for(var i:int = 0; i < from4To0.length; i++)
+            {
+                var object:ListCollectionView_Sort_VO = from4To0.getItemAt(i) as ListCollectionView_Sort_VO;
+                object[fieldName] = object.index;
+            }
+            _sut.addAll(from4To0); //values["name"]: Object4, Object3, Object2, Object1, Object0
+
+            const sortByIndexAscending:Sort = new Sort();
+            sortByIndexAscending.fields = [new SortField(fieldName, false, false, true)];
+            _sut.sort = sortByIndexAscending;
+
+            //when
+            _sut.refresh(); //should be: Object0, Object1, Object2, Object3, Object4
+
+            //then
+            assertIndexesAre([0, 1, 2, 3, 4]);
+            assertGetItemIndex(from4To0);
+            assertRemoveAll();
+        }
+
 
         [Test(description="Testing that changing the properties of the Sort doesn't impact the actual sort order")]
         public function test_sort_fields_on_complex_objects_dont_change_unless_sort_reapplied():void
@@ -413,7 +440,7 @@ package {
     }
 }
 
-class ListCollectionView_Sort_VO
+dynamic class ListCollectionView_Sort_VO
 {
     [Bindable]
     public var name:String;