Repository: flex-sdk
Updated Branches:
  refs/heads/develop 2c0c18713 -> 244f63300


FLEX-35043
Updating unit tests to reflect new behaviour.


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

Branch: refs/heads/develop
Commit: 244f6330052a6852fb860da9f6645e7f494f4ac2
Parents: 2c0c187
Author: Mihai Chira <mih...@apache.org>
Authored: Wed Mar 2 10:23:30 2016 +0100
Committer: Mihai Chira <mih...@apache.org>
Committed: Wed Mar 2 10:23:30 2016 +0100

----------------------------------------------------------------------
 ...tCollectionView_PropertyChangeEvent_Tests.as | 28 +++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/244f6330/frameworks/projects/framework/tests/mx/collections/ListCollectionView_PropertyChangeEvent_Tests.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/framework/tests/mx/collections/ListCollectionView_PropertyChangeEvent_Tests.as
 
b/frameworks/projects/framework/tests/mx/collections/ListCollectionView_PropertyChangeEvent_Tests.as
index ec41511..56d0b40 100644
--- 
a/frameworks/projects/framework/tests/mx/collections/ListCollectionView_PropertyChangeEvent_Tests.as
+++ 
b/frameworks/projects/framework/tests/mx/collections/ListCollectionView_PropertyChangeEvent_Tests.as
@@ -27,6 +27,7 @@ package mx.collections {
     import mx.utils.ObjectUtil;
 
     import org.flexunit.asserts.assertEquals;
+    import org.flexunit.asserts.assertNull;
     import org.flexunit.asserts.assertTrue;
 
     public class ListCollectionView_PropertyChangeEvent_Tests
@@ -136,7 +137,7 @@ package mx.collections {
         }
 
         [Test] //FLEX-35043
-        public function 
test_when_collection_item_dispatches_PropertyChangeEvent_null_is_removed_from_list():void
+        public function 
test_when_collection_item_dispatches_PropertyChangeEvent_null_is_not_removed_from_list():void
         {
             //given
             _sut.addItem(null);
@@ -150,7 +151,7 @@ package mx.collections {
 
             //then
             assertTrue(positionOfNull != -1);
-            assertEquals(-1, _sut.getItemIndex(null));
+            assertEquals(positionOfNull, _sut.getItemIndex(null));
             assertEquals(positionOfFirstWorkout, 
_sut.getItemIndex(_firstWorkout));
         }
 
@@ -194,7 +195,7 @@ package mx.collections {
         }
 
         [Test] //FLEX-35043
-        public function 
test_when_item_is_changed_bypassing_binding_and_collection_notified_of_itemUpdated_without_property_null_is_removed_from_list():void
+        public function 
test_when_item_is_changed_bypassing_binding_and_collection_notified_of_itemUpdated_without_property_null_is_not_removed_from_list():void
         {
             //given
             _sut.addItem(null);
@@ -210,12 +211,12 @@ package mx.collections {
 
             //then
             assertTrue(positionOfNull != -1);
-            assertEquals(-1, _sut.getItemIndex(null));
+            assertEquals(positionOfNull, _sut.getItemIndex(null));
             assertEquals(positionOfFirstWorkout, 
_sut.getItemIndex(_firstWorkout));
         }
 
         [Test] //FLEX-35043
-        public function 
test_when_collection_item_dispatches_PropertyChangeEvent_with_UPDATE_null_is_removed_from_list():void
+        public function 
test_when_collection_item_dispatches_PropertyChangeEvent_with_UPDATE_null_is_not_removed_from_list():void
         {
             //given
             _sut.addItem(null);
@@ -229,7 +230,7 @@ package mx.collections {
 
             //then
             assertTrue(positionOfNull != -1);
-            assertEquals(-1, _sut.getItemIndex(null));
+            assertEquals(positionOfNull, _sut.getItemIndex(null));
             assertEquals(positionOfFirstWorkout, 
_sut.getItemIndex(_firstWorkout));
         }
 
@@ -261,6 +262,7 @@ package mx.collections {
             var sort:InspectableSort = new InspectableSort([new 
SortField("name")]);
             _sut.sort = sort;
             _sut.refresh();
+
             const positionOfNull:int = _sut.getItemIndex(null);
             const positionOfFirstWorkout:int = 
_sut.getItemIndex(_firstWorkout);
 
@@ -289,13 +291,13 @@ package mx.collections {
             //object's correct position has been inspected with Sort
             assertEquals(_firstWorkout, InspectableSort.lastItemSearchedFor);
             //and null (PropertyChangeEvent.oldValue) has been sought for when 
trying to remove it
-            assertTrue(InspectableSort.itemsSearchedFor.indexOf(null) != -1);
+            assertEquals(-1, InspectableSort.itemsSearchedFor.indexOf(null));
             //and it's in the same position
             assertEquals(positionOfFirstWorkout, 
_sut.getItemIndex(_firstWorkout));
         }
 
         [Test] //FLEX-35043
-        public function 
test_when_collection_item_dispatches_PropertyChangeEvent_sort_compare_function_called_with_null_and_fatals_if_no_null_check():void
+        public function 
test_when_collection_item_dispatches_PropertyChangeEvent_sort_compare_function_not_called_with_null():void
         {
             function compareWorkouts(a:Object, b:Object, fields:Array = 
null):int
             {
@@ -314,12 +316,12 @@ package mx.collections {
             //when
             _firstWorkout.dispatchEvent(PROPERTY_CHANGE_EVENT);
 
-            //then - fatal because compareWorkouts was called with null, which 
it didn't expect (but should have)
-            assertTrue(_uncaughtError is TypeError);
+            //then - no fatal because compareWorkouts was not called with null 
as an argument
+            assertNull(_uncaughtError);
         }
 
         [Test] //FLEX-35043
-        public function 
test_when_collection_notified_of_itemUpdated_without_valid_property_sort_compare_function_called_with_null_and_fatals_if_no_null_check():void
+        public function 
test_when_collection_notified_of_itemUpdated_without_property_or_oldValue_sort_compare_function_not_called_with_null():void
         {
             function compareWorkouts(a:Object, b:Object, fields:Array = 
null):int
             {
@@ -340,8 +342,8 @@ package mx.collections {
             _firstWorkout.setMinAgeWithoutTriggeringBinding(20);
             _sut.itemUpdated(_firstWorkout);
 
-            //then - fatal because compareWorkouts was called with null, which 
it didn't expect (but should have)
-            assertTrue(_uncaughtError is TypeError);
+            //then - no fatal because compareWorkouts was not called with null
+            assertNull(_uncaughtError);
         }
 
         private static function allowAll(object:Object):Boolean

Reply via email to