Skip to content

Commit

Permalink
Fix journal and textarea tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktor-obrebski committed Jan 15, 2025
1 parent ee68d9f commit 8ee053a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/lua/gui/widgets/text_area/text_area_content.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function TextAreaContent:init()
self.clipboard_mode = CLIPBOARD_MODE.LOCAL
self.render_start_line_y = 1

self.cursor = 1
self.cursor = nil

self.main_pen = dfhack.pen.parse({
fg=self.text_pen,
Expand Down
5 changes: 5 additions & 0 deletions test/library/gui/widgets.EditField.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ local widgets = require('gui.widgets')

function test.editfield_cursor()
local e = widgets.EditField{}

-- cursor is normally set in `postUpdateLayout`, hard to test in unit tests
e:setCursor(1)
e:setFocus(true)
expect.eq(1, e.cursor, 'cursor should be after the empty string')

Expand Down Expand Up @@ -64,6 +67,8 @@ end

function test.editfield_ignore_keys()
local e = widgets.EditField{ignore_keys={'CUSTOM_B', 'CUSTOM_C'}}
-- cursor is normally set in `postUpdateLayout`, hard to test in unit tests
e:setCursor(1)
e:setFocus(true)

e:onInput{_STRING=string.byte('a'), CUSTOM_A=true}
Expand Down

0 comments on commit 8ee053a

Please sign in to comment.