@@ -88,10 +88,10 @@ async def test_ctrl_q_dirty_shows_prompt(self, temp_file):
8888 assert app ._prompt_mode == "quit_confirm"
8989 message_bar = app .query_one ("#message" , MessageBar )
9090 message_content = message_bar .message
91- assert "Quit anyway ?" in message_content
91+ assert "Save changes ?" in message_content
9292
93- async def test_confirm_quit_with_y (self , temp_file ):
94- """Pressing 'y' in confirmation prompt should quit."""
93+ async def test_confirm_quit_with_y_saves_and_exits (self , temp_file ):
94+ """Pressing 'y' in confirmation prompt should save and quit."""
9595 temp_file .write_text ("Original" )
9696 app = CommitEditorApp (temp_file )
9797
@@ -104,9 +104,11 @@ async def test_confirm_quit_with_y(self, temp_file):
104104 await pilot .press ("y" )
105105
106106 assert app ._exit is True
107+ # File should have been saved with the modified content
108+ assert temp_file .read_text () == "Modified\n "
107109
108- async def test_cancel_quit_with_n (self , temp_file ):
109- """Pressing 'n' in confirmation prompt should cancel quit."""
110+ async def test_discard_quit_with_n (self , temp_file ):
111+ """Pressing 'n' in confirmation prompt should quit without saving ."""
110112 temp_file .write_text ("Original" )
111113 app = CommitEditorApp (temp_file )
112114
@@ -118,13 +120,9 @@ async def test_cancel_quit_with_n(self, temp_file):
118120 await pilot .press ("ctrl+q" )
119121 await pilot .press ("n" )
120122
121- # Should not have exited, prompt mode should be cleared
122- assert app ._exit is False
123- assert app ._prompt_mode is None
124- message_bar = app .query_one ("#message" , MessageBar )
125- # Message bar should be cleared (empty)
126- message_content = message_bar .message
127- assert message_content == ""
123+ # Should have exited without saving
124+ assert app ._exit is True
125+ assert temp_file .read_text () == "Original"
128126
129127 async def test_cancel_quit_with_escape (self , temp_file ):
130128 """Pressing 'escape' in confirmation prompt should cancel quit."""
0 commit comments