flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mih...@apache.org
Subject [08/12] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34854 Added a unit test to show that a removed item is still being watched for changes. Will be fixed in the next commit.
Date Mon, 08 Jun 2015 18:02:35 GMT
FLEX-34854
Added a unit test to show that a removed item is still being watched for changes. Will be
fixed in the next commit.


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

Branch: refs/heads/develop
Commit: f68c6c94ff485fca999b68eb56e5489ad20a84ec
Parents: 017ab1f
Author: Mihai Chira <mihaic@apache.org>
Authored: Mon Jun 8 18:16:19 2015 +0200
Committer: Mihai Chira <mihaic@apache.org>
Committed: Mon Jun 8 18:16:19 2015 +0200

----------------------------------------------------------------------
 .../framework/tests/FLEX_34854_Tests.as         | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f68c6c94/frameworks/projects/framework/tests/FLEX_34854_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/tests/FLEX_34854_Tests.as b/frameworks/projects/framework/tests/FLEX_34854_Tests.as
index 9b579f8..f45fc96 100644
--- a/frameworks/projects/framework/tests/FLEX_34854_Tests.as
+++ b/frameworks/projects/framework/tests/FLEX_34854_Tests.as
@@ -25,6 +25,8 @@ package {
     import mx.collections.ListCollectionView;
     import mx.collections.Sort;
 
+    import org.flexunit.assertThat;
+
     import org.flexunit.asserts.assertEquals;
 
     public class FLEX_34854_Tests {
@@ -92,6 +94,36 @@ package {
             _sut.removeItemAt(_sut.getItemIndex(newItem)); //if the bug is present, this
will throw an RTE
         }
 
+        [Test]
+        public function test_removing_and_changing_complex_sort_field_value_keeps_it_away_from_collection():void
+        {
+            //given
+            var from1To4:IList = generateVOs(5);
+            from1To4.removeItemAt(0);
+            _sut.addAll(from1To4);
+
+            const sortByNameAscending:Sort = new Sort();
+            sortByNameAscending.fields = [new ComplexSortField("address.street", false, false,
false)];
+            _sut.sort = sortByNameAscending;
+            _sut.refresh(); //values: Object1, Object2, Object3, Object4
+
+            _sut.complexFieldWatcher = new ComplexFieldChangeWatcher();
+
+            //when
+            const removedItem:ListCollectionView_FLEX_34854_VO = _sut.getItemAt(0) as ListCollectionView_FLEX_34854_VO;
+            _sut.removeItemAt(0);
+            removedItem.address.street = "Street22";
+
+            //then
+            const newItemIndex:int = _sut.getItemIndex(removedItem);
+            assertEquals("the item should have been removed form the list", -1, newItemIndex);
+            for(var i:int = 0; i < _sut.length; i++)
+            {
+                var vo:ListCollectionView_FLEX_34854_VO = _sut.getItemAt(i) as ListCollectionView_FLEX_34854_VO;
+                assertThat(vo != removedItem);
+            }
+        }
+
         private function assertIndexesAre(indexes:Array):void
         {
             assertEquals(indexes.length, _sut.length);


Mime
View raw message