Compare commits

...

2 Commits

Author SHA1 Message Date
Shadowfacts b6eef7b317 Fix toolbar animation getting stuck partway 2020-12-22 21:17:42 -05:00
Shadowfacts 33e1f0dca6 Add Document.title test 2020-12-21 21:35:51 -05:00
2 changed files with 25 additions and 1 deletions

View File

@ -355,7 +355,7 @@ extension BrowserNavigationController: UIScrollViewDelegate {
guard trackingScroll else { return }
trackingScroll = false
if velocity.y == 0 {
if velocity.y == 0 && (toolbarOffset == 0 || toolbarOffset == 1) {
return
}

View File

@ -53,4 +53,28 @@ test
""")
}
func testGetTitle() {
let h1 = Document(url: URL(string: "gemini://example.com/")!, lines: [
.heading("Test", level: .h1)
])
XCTAssertEqual(h1.title, "Test")
let h2 = Document(url: URL(string: "gemini://example.com/")!, lines: [
.heading("Test", level: .h2)
])
XCTAssertEqual(h2.title, "Test")
let h3 = Document(url: URL(string: "gemini://example.com/")!, lines: [
.heading("Test", level: .h3)
])
XCTAssertEqual(h3.title, "Test")
let multiple = Document(url: URL(string: "gemini://example.com/")!, lines: [
.heading("Two", level: .h2),
.heading("One", level: .h1),
.heading("Three", level: .h3),
])
XCTAssertEqual(multiple.title, "Two")
}
}