diff --git a/apps/tests/ui/list-view/list-view-tests.ts b/apps/tests/ui/list-view/list-view-tests.ts index 11739337e..45cfb7808 100644 --- a/apps/tests/ui/list-view/list-view-tests.ts +++ b/apps/tests/ui/list-view/list-view-tests.ts @@ -161,6 +161,26 @@ export class ListViewTest extends testModule.UITest { } } + public test_cell_selection_ios() { + if (platform.device.os === platform.platformNames.ios) { + let listView = this.testView; + + let colors = ["red", "green", "blue"]; + listView.items = colors; + + TKUnit.waitUntilReady(() => { return this.getNativeViewCount(listView) === listView.items.length; }, ASYNC); + + var index = 1; + this.performNativeItemTap(listView, index); + var uiTableView = listView.ios; + var cellIndexPath = NSIndexPath.indexPathForItemInSection(index, 0); + var cell = uiTableView.cellForRowAtIndexPath(cellIndexPath); + uiTableView.selectRowAtIndexPathAnimatedScrollPosition(cellIndexPath, false, 0); + + TKUnit.assertTrue(cell.selected, "cell is selected"); + } + } + public test_set_items_to_array_creates_native_views() { var listView = this.testView; listView.on(listViewModule.ListView.itemLoadingEvent, this.loadViewWithItemNumber); @@ -482,7 +502,7 @@ export class ListViewTest extends testModule.UITest { TKUnit.assertEqual(secondNativeElementText, "2", "second element text"); TKUnit.assertEqual(thirdNativeElementText, "3", "third element text"); } - + public test_ItemTemplateFactoryFunction() { var listView = this.testView; diff --git a/ui/list-view/list-view.ios.ts b/ui/list-view/list-view.ios.ts index a451d3765..a6de7aebf 100644 --- a/ui/list-view/list-view.ios.ts +++ b/ui/list-view/list-view.ios.ts @@ -103,7 +103,12 @@ class UITableViewDelegateImpl extends NSObject implements UITableViewDelegate { if (owner) { notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath); } - cell.highlighted = false; + return indexPath; + } + + public tableViewDidSelectRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): NSIndexPath { + tableView.deselectRowAtIndexPathAnimated(indexPath, true); + return indexPath; } @@ -157,8 +162,7 @@ class UITableViewRowHeightDelegateImpl extends NSObject implements UITableViewDe if (owner) { notifyForItemAtIndex(owner, cell, cell.view, ITEMTAP, indexPath); } - cell.highlighted = false; - return indexPath; + return indexPath; } public tableViewHeightForRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): number {