@@ -36,4 +36,84 @@ describe("MarkdownBlock", () => {
3636 const paragraph = container . querySelector ( "p" )
3737 expect ( paragraph ?. textContent ) . toBe ( "Check out this link: https://example.com." )
3838 } )
39+
40+ it ( "should render unordered lists with proper styling" , async ( ) => {
41+ const markdown = `Here are some items:
42+ - First item
43+ - Second item
44+ - Nested item
45+ - Another nested item`
46+
47+ const { container } = render ( < MarkdownBlock markdown = { markdown } /> )
48+
49+ // Wait for the content to be processed
50+ await screen . findByText ( / H e r e a r e s o m e i t e m s / , { exact : false } )
51+
52+ // Check that ul elements exist
53+ const ulElements = container . querySelectorAll ( "ul" )
54+ expect ( ulElements . length ) . toBeGreaterThan ( 0 )
55+
56+ // Check that list items exist
57+ const liElements = container . querySelectorAll ( "li" )
58+ expect ( liElements . length ) . toBe ( 4 )
59+
60+ // Verify the text content
61+ expect ( screen . getByText ( "First item" ) ) . toBeInTheDocument ( )
62+ expect ( screen . getByText ( "Second item" ) ) . toBeInTheDocument ( )
63+ expect ( screen . getByText ( "Nested item" ) ) . toBeInTheDocument ( )
64+ expect ( screen . getByText ( "Another nested item" ) ) . toBeInTheDocument ( )
65+ } )
66+
67+ it ( "should render ordered lists with proper styling" , async ( ) => {
68+ const markdown = `And a numbered list:
69+ 1. Step one
70+ 2. Step two
71+ 3. Step three`
72+
73+ const { container } = render ( < MarkdownBlock markdown = { markdown } /> )
74+
75+ // Wait for the content to be processed
76+ await screen . findByText ( / A n d a n u m b e r e d l i s t / , { exact : false } )
77+
78+ // Check that ol elements exist
79+ const olElements = container . querySelectorAll ( "ol" )
80+ expect ( olElements . length ) . toBe ( 1 )
81+
82+ // Check that list items exist
83+ const liElements = container . querySelectorAll ( "li" )
84+ expect ( liElements . length ) . toBe ( 3 )
85+
86+ // Verify the text content
87+ expect ( screen . getByText ( "Step one" ) ) . toBeInTheDocument ( )
88+ expect ( screen . getByText ( "Step two" ) ) . toBeInTheDocument ( )
89+ expect ( screen . getByText ( "Step three" ) ) . toBeInTheDocument ( )
90+ } )
91+
92+ it ( "should render nested lists with proper hierarchy" , async ( ) => {
93+ const markdown = `Complex list:
94+ 1. First level ordered
95+ - Second level unordered
96+ - Another second level
97+ 1. Third level ordered
98+ 2. Another third level
99+ 2. Back to first level`
100+
101+ const { container } = render ( < MarkdownBlock markdown = { markdown } /> )
102+
103+ // Wait for the content to be processed
104+ await screen . findByText ( / C o m p l e x l i s t / , { exact : false } )
105+
106+ // Check nested structure
107+ const olElements = container . querySelectorAll ( "ol" )
108+ const ulElements = container . querySelectorAll ( "ul" )
109+
110+ expect ( olElements . length ) . toBeGreaterThan ( 0 )
111+ expect ( ulElements . length ) . toBeGreaterThan ( 0 )
112+
113+ // Verify all text is rendered
114+ expect ( screen . getByText ( "First level ordered" ) ) . toBeInTheDocument ( )
115+ expect ( screen . getByText ( "Second level unordered" ) ) . toBeInTheDocument ( )
116+ expect ( screen . getByText ( "Third level ordered" ) ) . toBeInTheDocument ( )
117+ expect ( screen . getByText ( "Back to first level" ) ) . toBeInTheDocument ( )
118+ } )
39119} )
0 commit comments