@@ -85,3 +85,47 @@ def test_copy_cell_preserves_literal_brackets_when_not_rendering_markup() -> Non
8585 app = _FakeApp ([("[bold]hello" ,)], render_markup = False )
8686 app .action_copy_cell ()
8787 assert app .clipboard_text == "[bold]hello"
88+
89+ class _FakeQueryInput :
90+ def __init__ (self ) -> None :
91+ self .text = ""
92+ self .cursor_location = (0 , 0 )
93+ self .read_only = True
94+
95+ def focus (self ) -> None :
96+ pass
97+
98+
99+ class _FakeEditApp (_FakeApp ):
100+ def __init__ (self , cells : list [tuple [str , ...]], columns : list [str ]) -> None :
101+ super ().__init__ (cells , render_markup = True )
102+ self ._columns = columns
103+ self .query_input = _FakeQueryInput ()
104+ self ._suppress_autocomplete_once = False
105+
106+ def _get_active_results_context (self ) -> tuple [Any , list , list , bool ]:
107+ return self ._table , self ._columns , [], False
108+
109+ def _get_active_results_table_info (self , _table : Any , _stacked : bool ) -> dict [str , Any ]:
110+ return {"name" : "users" , "columns" : []}
111+
112+ def action_focus_query (self ) -> None :
113+ pass
114+
115+ def _update_footer_bindings (self ) -> None :
116+ pass
117+
118+ def _update_vim_mode_visuals (self ) -> None :
119+ pass
120+
121+
122+ def test_delete_row_strips_filter_markup_before_generating_sql () -> None :
123+ app = _FakeEditApp ([("[bold #FFFF00]Ja[/]ne" ,)], ["name" ])
124+ app .action_delete_row ()
125+ assert app .query_input .text == "DELETE FROM users WHERE name = 'Jane';"
126+
127+
128+ def test_edit_cell_strips_filter_markup_before_generating_sql () -> None :
129+ app = _FakeEditApp ([("[bold #FFFF00]Ja[/]ne" ,)], ["name" ])
130+ app .action_edit_cell ()
131+ assert "WHERE name = 'Jane';" in app .query_input .text
0 commit comments