feat: restyle emoji picker with sectioned tiles
This commit is contained in:
@@ -71,8 +71,13 @@ import Testing
|
||||
func expectVisible() throws {
|
||||
picker.copySelection()
|
||||
let index = try #require(ordered.firstIndex { $0.value == pasteboard.string(forType: .string) })
|
||||
let path = favorites && index >= favored.count
|
||||
? IndexPath(item: index - favored.count, section: 1) : IndexPath(item: index, section: 0)
|
||||
var item = index
|
||||
var section = 0
|
||||
while item >= grid.numberOfItems(inSection: section) {
|
||||
item -= grid.numberOfItems(inSection: section)
|
||||
section += 1
|
||||
}
|
||||
let path = IndexPath(item: item, section: section)
|
||||
let frame = try #require(grid.collectionViewLayout?.layoutAttributesForItem(at: path)?.frame)
|
||||
try #require(scroll.documentVisibleRect.contains(frame))
|
||||
}
|
||||
@@ -239,7 +244,7 @@ import Testing
|
||||
#expect(table.numberOfRows == 1)
|
||||
}
|
||||
|
||||
@Test @MainActor func emojiFavoritesPersistAndNavigationCrossesTheSpacingBreak() throws {
|
||||
@Test @MainActor func emojiFavoritesPersistAndNavigationCrossesSections() throws {
|
||||
_ = NSApplication.shared
|
||||
let suite = "ConjureEmojiFavorites.\(UUID().uuidString)"
|
||||
let defaults = UserDefaults(suiteName: suite)!
|
||||
@@ -254,9 +259,6 @@ import Testing
|
||||
query = ""
|
||||
picker.inputChanged()
|
||||
picker.view.layoutSubtreeIfNeeded()
|
||||
let grid = try #require(picker.view.subviews.compactMap { $0 as? NSScrollView }.first?.documentView as? NSCollectionView)
|
||||
#expect(grid.numberOfSections == 2)
|
||||
#expect(grid.numberOfItems(inSection: 0) == 1)
|
||||
#expect(picker.handleControlKey("j"))
|
||||
picker.copySelection()
|
||||
#expect(pasteboard.string(forType: .string) == EmojiCatalog.all[0].value)
|
||||
@@ -271,7 +273,6 @@ import Testing
|
||||
#expect(picker.handleControlKey("k"))
|
||||
picker.toggleFavorite()
|
||||
#expect(defaults.stringArray(forKey: "favoriteEmoji") == [])
|
||||
#expect(grid.numberOfSections == 1)
|
||||
query = "👩💻"
|
||||
picker.inputChanged()
|
||||
picker.toggleFavorite()
|
||||
|
||||
Reference in New Issue
Block a user