@@ -153,35 +153,45 @@ def test_get_by_title(page: Page) -> None:
153
153
154
154
def test_get_by_escaping (page : Page ) -> None :
155
155
page .set_content (
156
- """<label id=label for=control>Hello
156
+ """<label id=label for=control>Hello my
157
157
wo"rld</label><input id=control />"""
158
158
)
159
159
page .locator ("input" ).evaluate (
160
160
"""input => {
161
- input.setAttribute('placeholder', 'hello\\ nwo"rld');
162
- input.setAttribute('title', 'hello\\ nwo"rld');
163
- input.setAttribute('alt', 'hello\\ nwo"rld');
161
+ input.setAttribute('placeholder', 'hello my \\ nwo"rld');
162
+ input.setAttribute('title', 'hello my \\ nwo"rld');
163
+ input.setAttribute('alt', 'hello my \\ nwo"rld');
164
164
}"""
165
165
)
166
- expect (page .get_by_text ('hello\n wo"rld' )).to_have_attribute ("id" , "label" )
167
- expect (page .get_by_label ('hello\n wo"rld' )).to_have_attribute ("id" , "control" )
168
- expect (page .get_by_placeholder ('hello\n wo"rld' )).to_have_attribute ("id" , "control" )
169
- expect (page .get_by_alt_text ('hello\n wo"rld' )).to_have_attribute ("id" , "control" )
170
- expect (page .get_by_title ('hello\n wo"rld' )).to_have_attribute ("id" , "control" )
166
+ expect (page .get_by_text ('hello my\n wo"rld' )).to_have_attribute ("id" , "label" )
167
+ expect (page .get_by_text ('hello my wo"rld' )).to_have_attribute (
168
+ "id" , "label"
169
+ )
170
+ expect (page .get_by_label ('hello my\n wo"rld' )).to_have_attribute ("id" , "control" )
171
+ expect (page .get_by_placeholder ('hello my\n wo"rld' )).to_have_attribute (
172
+ "id" , "control"
173
+ )
174
+ expect (page .get_by_alt_text ('hello my\n wo"rld' )).to_have_attribute ("id" , "control" )
175
+ expect (page .get_by_title ('hello my\n wo"rld' )).to_have_attribute ("id" , "control" )
171
176
172
177
page .set_content (
173
- """<label id=label for=control>Hello
178
+ """<label id=label for=control>Hello my
174
179
world</label><input id=control />"""
175
180
)
176
181
page .locator ("input" ).evaluate (
177
182
"""input => {
178
- input.setAttribute('placeholder', 'hello\\ nworld');
179
- input.setAttribute('title', 'hello\\ nworld');
180
- input.setAttribute('alt', 'hello\\ nworld');
183
+ input.setAttribute('placeholder', 'hello my \\ nworld');
184
+ input.setAttribute('title', 'hello my \\ nworld');
185
+ input.setAttribute('alt', 'hello my \\ nworld');
181
186
}"""
182
187
)
183
- expect (page .get_by_text ("hello\n world" )).to_have_attribute ("id" , "label" )
184
- expect (page .get_by_label ("hello\n world" )).to_have_attribute ("id" , "control" )
185
- expect (page .get_by_placeholder ("hello\n world" )).to_have_attribute ("id" , "control" )
186
- expect (page .get_by_alt_text ("hello\n world" )).to_have_attribute ("id" , "control" )
187
- expect (page .get_by_title ("hello\n world" )).to_have_attribute ("id" , "control" )
188
+ expect (page .get_by_text ("hello my\n world" )).to_have_attribute ("id" , "label" )
189
+ expect (page .get_by_text ("hello my world" )).to_have_attribute (
190
+ "id" , "label"
191
+ )
192
+ expect (page .get_by_label ("hello my\n world" )).to_have_attribute ("id" , "control" )
193
+ expect (page .get_by_placeholder ("hello my\n world" )).to_have_attribute (
194
+ "id" , "control"
195
+ )
196
+ expect (page .get_by_alt_text ("hello my\n world" )).to_have_attribute ("id" , "control" )
197
+ expect (page .get_by_title ("hello my\n world" )).to_have_attribute ("id" , "control" )
0 commit comments