aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-12-19 11:27:08 -0500
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-12-19 11:27:08 -0500
commitf107c48f8fbc4ef27b2bb1d4d01420229421b885 (patch)
treea6606edcdc5e25ad926b656d94d578014871b47f /test
parentdc659bcfb7adbd9e65631507c29976d2903a3950 (diff)
Ensure a bare `ui.find.focus()` call resets incremental and in files options.
Diffstat (limited to 'test')
-rw-r--r--test/test.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index 37f525b2..25aff22a 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -2656,6 +2656,23 @@ function test_find_replace_regex_transforms()
buffer:close(true)
end
+function test_ui_find_focus()
+ buffer:new()
+ buffer:append_text(' foo\n\n foo')
+ ui.find.focus{incremental = true}
+ ui.find.find_entry_text = 'foo'
+ if CURSES then events.emit(events.FIND_TEXT_CHANGED) end -- simulate
+ assert_equal(buffer:line_from_position(buffer.current_pos), 1)
+ buffer:line_down()
+ ui.find.focus() -- should turn off incremental find
+ ui.find.find_entry_text = 'f'
+ if CURSES then events.emit(events.FIND_TEXT_CHANGED) end -- simulate
+ assert_equal(buffer:line_from_position(buffer.current_pos), 2)
+ buffer:close(true)
+
+ assert_raises(function() ui.find.focus(1) end, 'table/nil expected, got number')
+end
+
function test_history()
local filename1 = _HOME .. '/test/modules/textadept/history/1'
io.open_file(filename1)