@@ -69,6 +69,33 @@ describe("UI Tests", function()
6969 })
7070 assert .is_equal (segment .text , " a_very_very_very_…" )
7171 end )
72+
73+ it (" should render an icon if show_modified is true" , function ()
74+ config .setup ({ options = { show_modified = true } })
75+ config .apply ()
76+ local buf = MockBuffer :new ({ id = 1 , name = " file.txt" , length = 10 , modified = true })
77+ local el = ui .element ({}, buf )
78+ local segment = ui .to_tabline_str (el :component (1 ))
79+ assert .is_truthy (segment :match (config .options .modified_icon ))
80+ end )
81+
82+ it (" should not render an icon if show_modified is false" , function ()
83+ config .setup ({ options = { show_modified = false } })
84+ config .apply ()
85+ local buf = MockBuffer :new ({ id = 1 , name = " file.txt" , length = 10 , modified = true })
86+ local el = ui .element ({}, buf )
87+ local segment = ui .to_tabline_str (el :component (1 ))
88+ assert .is_falsy (segment :match (config .options .modified_icon ))
89+ end )
90+
91+ it (" should render an icon if show_modified is a function" , function ()
92+ config .setup ({ options = { show_modified = function (context ) return true end } })
93+ config .apply ()
94+ local buf = MockBuffer :new ({ id = 1 , name = " file.txt" , length = 10 , modified = true })
95+ local el = ui .element ({}, buf )
96+ local segment = ui .to_tabline_str (el :component (1 ))
97+ assert .is_truthy (segment :match (config .options .modified_icon ))
98+ end )
7299 end )
73100
74101 describe (" Hover events - " , function ()
0 commit comments