File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,11 @@ bot.action.clear = function (element) {
119
119
// A single space is required, if you put empty string here you'll not be
120
120
// able to interact with this element anymore in Firefox.
121
121
bot . action . LegacyDevice_ . focusOnElement ( element ) ;
122
- element . innerHTML = goog . userAgent . GECKO ? ' ' : '' ;
122
+ if ( goog . userAgent . GECKO ) {
123
+ element . innerHTML = ' ' ;
124
+ } else {
125
+ element . textContent = '' ;
126
+ }
123
127
var body = bot . getDocument ( ) . body ;
124
128
if ( body ) {
125
129
bot . action . LegacyDevice_ . focusOnElement ( body ) ;
Original file line number Diff line number Diff line change 5
5
< script src ="test_bootstrap.js "> </ script >
6
6
< script type ="text/javascript ">
7
7
goog . require ( 'bot.action' ) ;
8
+ goog . require ( 'bot.locators' ) ;
8
9
goog . require ( 'goog.Promise' ) ;
9
10
goog . require ( 'goog.Uri' ) ;
10
11
goog . require ( 'goog.dom' ) ;
122
123
expectBlurEvent ( e ) ;
123
124
expectChangeEvent ( e ) ;
124
125
bot . action . clear ( e ) ;
125
- assertBlurFired ( ) ;
126
+ if ( goog . userAgent . IE ) {
127
+ assertBlurFired ( ) ;
128
+ }
126
129
assertChangeFired ( ) ;
127
130
assertEquals ( '' , e . value ) ;
128
131
} ) ;
197
200
assertEquals ( "3" , goog . dom . forms . getValue ( e ) ) ;
198
201
}
199
202
203
+ function testClearingAIframeContentEditableArea ( ) {
204
+ var iframe = goog . dom . getElement ( 'iframe' ) ;
205
+ var iframeDoc = goog . dom . getFrameContentDocument ( iframe ) ;
206
+
207
+ var e = bot . locators . findElement ( { id : 'content-editable' } , iframeDoc ) ;
208
+ bot . action . clear ( e ) ;
209
+ assertEquals ( '' , bot . dom . getVisibleText ( e ) ) ;
210
+ }
211
+
200
212
function testSubmittingANonFormElementShouldResultInAnError ( ) {
201
213
assertThrows ( goog . partial ( bot . action . submit , document . body ) ) ;
202
214
}
300
312
< div id ="child-not-content-editable "> child not content editable
301
313
</ div >
302
314
</ div >
315
+ < iframe id ="iframe " src ="testdata/trusted_types_iframe.html ">
316
+ </ iframe >
303
317
</ body >
304
318
</ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta http-equiv ="Content-Security-Policy " content ="require-trusted-types-for 'script'; ">
5
+ </ head >
6
+ < body >
7
+ < div id ="content-editable " contentEditable ="true "> This is a contentEditable area
8
+ < div id ="child-content-editable "> child content editable
9
+ </ div >
10
+ </ div >
11
+ </ body >
12
+ </ html >
You can’t perform that action at this time.
0 commit comments