[
https://issues.apache.org/jira/browse/FLEX-34885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Chira resolved FLEX-34885.
--------------------------------
Resolution: Fixed
> When changing the original Array and marking the item as updated in a sorted
> collection, the removed item is still in the collection
> ------------------------------------------------------------------------------------------------------------------------------------
>
> Key: FLEX-34885
> URL: https://issues.apache.org/jira/browse/FLEX-34885
> Project: Apache Flex
> Issue Type: Bug
> Components: Spark: Sort and SortField
> Affects Versions: Apache Flex 4.14.1
> Reporter: Mihai Chira
> Assignee: Mihai Chira
> Fix For: Apache Flex 4.15.0
>
>
> See the
> {code}ListCollectionView_Sort_Tests.test_marking_entire_item_as_updated_gets_the_old_object_out_of_the_list(){code}
> unit test:
> {code}
> [Test]
> public function
> test_marking_entire_item_as_updated_gets_the_old_object_out_of_the_list():void
> {
> //given
> var from0To4:IList = generateVOs(5, true); //values["name"]:
> Object4, Object3, Object2, Object1, Object0
> _sut.addAll(from0To4);
> const sortByNameAscending:Sort = new Sort();
> sortByNameAscending.fields = [new SortField("name", false, false,
> false)];
> _sut.sort = sortByNameAscending;
> _sut.refresh(); //values["name"]: Object0, Object1, Object2,
> Object3, Object4
> //when
> const removedItem:ListCollectionView_Sort_VO = (_sut.list as
> ArrayList).source[0] as ListCollectionView_Sort_VO;
> const newItem:ListCollectionView_Sort_VO = generateOneObject(-1);
> (_sut.list as ArrayList).source[0] = newItem;
> _sut.itemUpdated(newItem, null, removedItem, newItem);
> removedItem.name = "Object7"; //should make no difference
> newItem.name = "Object9"; //should place it at the end of the list
> //then
> const indexOfRemovedItem:int = _sut.getItemIndex(removedItem);
> assertEquals("the item should have been removed from the list",
> -1, indexOfRemovedItem);
> for(var i:int = 0; i < _sut.length; i++)
> {
> assertThat(_sut.getItemAt(i) != removedItem);
> }
> assertEquals("the new item should have been moved to the end of
> the list", _sut.length - 1, _sut.getItemIndex(newItem));
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)