Last active
September 28, 2018 14:16
-
-
Save milanstevanovic/6ae46f046a211ed9345299d781f585cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final class SearchResultsPage: UIElementPage<UIElements.Pages.SearchResultsPage> { | |
| private(set) lazy var searchBar = SearchBar() | |
| private(set) lazy var headerTitle = self.staticText(.resultsLabel) | |
| private(set) lazy var tagCollectionView = self.collection(.tagsCollectionView) | |
| private(set) lazy var searchResultsTableView = self.table(.tableView) | |
| var stockSearchResults: [SearchResultsCell] { | |
| get { | |
| let elements = self.searchResultsTableView.cells.allElementsBoundByIndex.filter { $0.identifier.contains(UIElements.Cells.SearchResultsCell.root.rawValue) } | |
| return elements.map { SearchResultsCell(element: $0) } | |
| } | |
| } | |
| var tagSearchResults: [SearchResultsTagCell] { | |
| get { | |
| let elements = self.tagCollectionView.cells.allElementsBoundByIndex.filter { $0.identifier.contains(UIElements.Cells.SearchResultsTagCell.root.rawValue) } | |
| return elements.map { SearchResultsTagCell(element: $0) } | |
| } | |
| } | |
| lazy var spinner = Spinner() | |
| lazy var errorDialog = ErrorDefaultDialog() | |
| init() { | |
| super.init(root: .root) | |
| } | |
| @discardableResult func dismiss() -> SearchPage { | |
| self.searchBar.tapCancelButton() | |
| return SearchPage() | |
| } | |
| func search(for text: String) { | |
| self.searchBar.text = text | |
| } | |
| func clearSearch() { | |
| self.searchBar.tapClearButton() | |
| } | |
| @discardableResult func tapOnStockItem(_ item: Int) -> ProductProfilePage { | |
| self.stockSearchResults[item].tap() | |
| return ProductProfilePage() | |
| } | |
| func tapOnTagItem(_ item: Int) { | |
| self.tagSearchResults[item].tap() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment