restores Helder in all its glory
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import HelderCore
|
||||
import Testing
|
||||
|
||||
@Suite struct ColumnLayoutTests {
|
||||
@Test func roomyWindowUsesTheDesignRatios() {
|
||||
let w = ColumnLayout.fluid(windowWidth: 1760, focus: .terminal)
|
||||
#expect(w == ColumnWidths(sourceControl: 236, explorer: 289, agent: 480))
|
||||
}
|
||||
|
||||
@Test func tightWindowFollowsFocus() {
|
||||
#expect(ColumnLayout.fluid(windowWidth: 1200, focus: .terminal).agent == 600)
|
||||
#expect(ColumnLayout.fluid(windowWidth: 1200, focus: .editor).agent == 240)
|
||||
}
|
||||
|
||||
@Test func fittingKeepsTheEditorMinimum() {
|
||||
let fitted = ColumnLayout.fitted(ColumnWidths(sourceControl: 400, explorer: 400, agent: 400), windowWidth: 1000, sourceControlVisible: true)
|
||||
#expect(fitted.sourceControl + fitted.explorer + fitted.agent <= 1000 - 3 - ColumnLayout.minEditorWidth)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import Foundation
|
||||
import HelderCore
|
||||
import Testing
|
||||
|
||||
@Suite struct SessionStateTests {
|
||||
@Test func anOlderSessionWithOpenTabsAndAnOriginalModeStillDecodes() throws {
|
||||
let json = #"""
|
||||
{"active":"b.php","openTabs":["a.php","b.php"],
|
||||
"tabMode":{"a.php":"original","b.php":"preview","c.php":"updated"},
|
||||
"tabSide":{"b.php":"staged"}}
|
||||
"""#
|
||||
let state = try JSONDecoder().decode(SessionState.self, from: Data(json.utf8))
|
||||
#expect(state.active == "b.php")
|
||||
#expect(state.modes == ["b.php": .preview, "c.php": .actual])
|
||||
#expect(state.sides == ["b.php": .staged])
|
||||
}
|
||||
|
||||
@Test func aSessionRoundTripsUnderItsStoredKeys() throws {
|
||||
let state = SessionState(active: "a.php", modes: ["a.php": .preview], sides: ["a.php": .unstaged])
|
||||
let data = try JSONEncoder().encode(state)
|
||||
let object = try #require(try JSONSerialization.jsonObject(with: data) as? [String: Any])
|
||||
#expect(Set(object.keys) == ["active", "tabMode", "tabSide"])
|
||||
#expect(try JSONDecoder().decode(SessionState.self, from: data) == state)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user