Skip to content

Commit 78d6a2f

Browse files
committed
fixup: a couple more tests
1 parent 1286ff0 commit 78d6a2f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/library/gui/widgets.TabBar.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,23 @@ function test.key_back_should_scroll_previous_tab_into_view_if_necessary_when_wr
533533
expect.eq(tb:get_cur_page(), 3, 'key back should select the previous tab')
534534
expect.gt(tb.scroll_offset, scroll_offset_before_input, 'key back should scroll the previous tab into view')
535535
end
536+
537+
function test.scroll_offset_is_reset_if_width_changes()
538+
local tb = setup({frame_width=10})
539+
540+
tb:postComputeFrame({t=0,l=0,width=100})
541+
542+
expect.eq(tb.scroll_offset, 0, 'scroll offset should be reset when parent frame width changes')
543+
544+
tb.scroll_offset = -50
545+
546+
tb:postComputeFrame({t=0,l=0,width=100})
547+
548+
expect.eq(tb.scroll_offset, -50, 'scroll offset should not be reset when parent frame width does not change')
549+
end
550+
551+
function test.offset_to_show_last_tab_is_calculated_on_first_render()
552+
local tb = setup({frame_width=10})
553+
554+
expect.lt(tb.offset_to_show_last_tab, 0, 'offset_to_show_last_tab should be calculated on first render')
555+
end

0 commit comments

Comments
 (0)