77
88from  .._types  import  PatternOrStr , Timeout 
99from  ..expect ._internal  import  expect_class_to_have_value  as  _expect_class_to_have_value 
10+ from  ..expect ._internal  import  expect_style_to_have_value  as  _expect_style_to_have_value 
1011from  ._base  import  UiWithContainer , WidthLocM 
1112
1213
@@ -32,6 +33,14 @@ class Sidebar(
3233    """ 
3334    Playwright `Locator` for the position of the sidebar. 
3435    """ 
36+     loc_content : Locator 
37+     """ 
38+     Playwright `Locator` for the content of the sidebar. 
39+     """ 
40+     loc_title : Locator 
41+     """ 
42+     Playwright `Locator` for the title of the sidebar. 
43+     """ 
3544
3645    def  __init__ (self , page : Page , id : str ) ->  None :
3746        """ 
@@ -52,6 +61,8 @@ def __init__(self, page: Page, id: str) -> None:
5261        )
5362        self .loc_handle  =  self .loc_container .locator ("button.collapse-toggle" )
5463        self .loc_position  =  self .loc .locator (".." )
64+         self .loc_content  =  self .loc .locator ("> div.sidebar-content" )
65+         self .loc_title  =  self .loc_content .locator ("> header.sidebar-title" )
5566
5667    def  expect_text (self , value : PatternOrStr , * , timeout : Timeout  =  None ) ->  None :
5768        """ 
@@ -64,7 +75,92 @@ def expect_text(self, value: PatternOrStr, *, timeout: Timeout = None) -> None:
6475        timeout 
6576            The maximum time to wait for the text to appear. Defaults to `None`. 
6677        """ 
67-         playwright_expect (self .loc ).to_have_text (value , timeout = timeout )
78+         playwright_expect (self .loc_content ).to_have_text (value , timeout = timeout )
79+ 
80+     def  expect_class (
81+         self ,
82+         class_name : str ,
83+         * ,
84+         has_class : bool  =  True ,
85+         timeout : Timeout  =  None ,
86+     ) ->  None :
87+         """ 
88+         Asserts that the sidebar has or does not have a CSS class. 
89+ 
90+         Parameters 
91+         ---------- 
92+         class_name 
93+             The CSS class to check for. 
94+         has_class 
95+             `True` if the sidebar should have the CSS class, `False` otherwise. 
96+         timeout 
97+             The maximum time to wait for the sidebar to appear. Defaults to `None`. 
98+         """ 
99+         _expect_class_to_have_value (
100+             self .loc ,
101+             class_name ,
102+             has_class = has_class ,
103+             timeout = timeout ,
104+         )
105+ 
106+     def  expect_gap (self , value : PatternOrStr , * , timeout : Timeout  =  None ) ->  None :
107+         """ 
108+         Asserts that the sidebar has the expected gap. 
109+ 
110+         Parameters 
111+         ---------- 
112+         value 
113+             The expected gap of the sidebar. 
114+         timeout 
115+             The maximum time to wait for the gap to appear. Defaults to `None`. 
116+         """ 
117+         _expect_style_to_have_value (self .loc_content , "gap" , value , timeout = timeout )
118+ 
119+     def  expect_bg_color (self , value : PatternOrStr , * , timeout : Timeout  =  None ) ->  None :
120+         """ 
121+         Asserts that the sidebar has the expected background color. 
122+ 
123+         Parameters 
124+         ---------- 
125+         value 
126+             The expected background color of the sidebar. 
127+         timeout 
128+             The maximum time to wait for the background color to appear. Defaults to `None`. 
129+         """ 
130+         _expect_style_to_have_value (
131+             self .loc_container , "--_sidebar-bg" , value , timeout = timeout 
132+         )
133+ 
134+     def  expect_title (self , value : PatternOrStr , * , timeout : Timeout  =  None ) ->  None :
135+         """ 
136+         Asserts that the sidebar has the expected title. 
137+ 
138+         Parameters 
139+         ---------- 
140+         value 
141+             The expected title of the sidebar. 
142+         timeout 
143+             The maximum time to wait for the title to appear. Defaults to `None`. 
144+         """ 
145+         playwright_expect (self .loc_title ).to_have_text (value , timeout = timeout )
146+ 
147+     def  expect_padding (
148+         self , value : list [PatternOrStr ], * , timeout : Timeout  =  None 
149+     ) ->  None :
150+         """ 
151+         Asserts that the sidebar has the expected padding. 
152+ 
153+         Parameters 
154+         ---------- 
155+         value 
156+             The expected padding of the sidebar. 
157+         timeout 
158+             The maximum time to wait for the padding to appear. Defaults to `None`. 
159+         """ 
160+         padding_val  =  " " .join (map (str , value ))
161+         _expect_style_to_have_value (
162+             self .loc_content , "padding" , padding_val , timeout = timeout 
163+         )
68164
69165    def  expect_position (
70166        self ,
0 commit comments