update the UI
This commit is contained in:
@@ -406,6 +406,50 @@ import Testing
|
||||
#expect(harness.model.editor?.activePath == nil)
|
||||
}
|
||||
|
||||
@Test func cancellingTheUnsavedPromptLeavesTheExplorerAndFocusAlone() async {
|
||||
let harness = WorkspaceHarness(contents: ["a.php": "one", "b.php": "b"])
|
||||
await harness.start()
|
||||
harness.model.open("a.php")
|
||||
await harness.model.settle()
|
||||
harness.model.editor?.edit("two")
|
||||
harness.model.layout.setFocusZone(.terminal)
|
||||
harness.system.unsavedCloseChoice = .cancel
|
||||
harness.model.open("b.php")
|
||||
await harness.model.settle()
|
||||
#expect(harness.system.unsavedCloseQuestions == ["a.php"])
|
||||
#expect(harness.model.editor?.activePath == "a.php")
|
||||
#expect(harness.model.explorer?.selectedPath == "a.php")
|
||||
#expect(harness.model.layout.focusZone == .terminal)
|
||||
}
|
||||
|
||||
@Test func aFailedSaveLeavesTheExplorerOnTheDirtyFile() async {
|
||||
let harness = WorkspaceHarness(contents: ["a.php": "one", "b.php": "b"])
|
||||
await harness.start()
|
||||
harness.model.open("a.php")
|
||||
await harness.model.settle()
|
||||
harness.model.editor?.edit("two")
|
||||
harness.system.unsavedCloseChoice = .save
|
||||
harness.files.failWrites = true
|
||||
harness.model.open("b.php")
|
||||
await harness.model.settle()
|
||||
#expect(harness.model.editor?.activePath == "a.php")
|
||||
#expect(harness.model.explorer?.selectedPath == "a.php")
|
||||
}
|
||||
|
||||
@Test func savingOnTheUnsavedPromptThenRevealsTheNewFile() async {
|
||||
let harness = WorkspaceHarness(contents: ["a.php": "one", "b.php": "b"])
|
||||
await harness.start()
|
||||
harness.model.open("a.php")
|
||||
await harness.model.settle()
|
||||
harness.model.editor?.edit("two")
|
||||
harness.system.unsavedCloseChoice = .save
|
||||
harness.model.open("b.php")
|
||||
await harness.model.settle()
|
||||
#expect(harness.files.current("a.php") == "two")
|
||||
#expect(harness.model.editor?.activePath == "b.php")
|
||||
#expect(harness.model.explorer?.selectedPath == "b.php")
|
||||
}
|
||||
|
||||
@Test func commandWWithoutAnOpenFileClosesTheWindow() async {
|
||||
let harness = WorkspaceHarness()
|
||||
await harness.start()
|
||||
|
||||
Reference in New Issue
Block a user