Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Support "flat index" lookups on tables and collection views #99

Open
briancroom opened this issue Nov 10, 2014 · 1 comment
Open

Support "flat index" lookups on tables and collection views #99

briancroom opened this issue Nov 10, 2014 · 1 comment

Comments

@briancroom
Copy link
Contributor

Recently I have been noticing that many of my specs around table views and collection views are looking for cells at particular locations, however the full (row/item)+section pair is an implementation detail, causing the tests to break horribly if choose to refactor the way that the view controller is using sections internally. I have started using a category that allows looking up cells by an integer "flat index" instead, treating all cells as if they were part of a simple list.

Does this sound like a useful thing to add to PCK as a spec helper? I'd be glad to open a PR if there is any interest.

@akitchen
Copy link
Contributor

Hey @pivotal-brian-croom

A PR for a helper here would be welcome of course. I'm neutral on this - I tend to use a combination of visibleCells and scrollToItem* but that's the kind of hackery you're trying to remove the need for. There are also going to be questions about getting cells through the table view vs. directly from the dataSource/delegate objects. My preference is to retrieve cells through the table view as it implicitly tests the delegate/dataSource wiring, but reasonable people can disagree here.

FYI, @jeffh 's Robot lib also has an API for this, https://github.com/jeffh/Robot#table-views , but we haven't been using Robot on many projects yet

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants