File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,7 +119,11 @@ bot.action.clear = function (element) {
119119 // A single space is required, if you put empty string here you'll not be
120120 // able to interact with this element anymore in Firefox.
121121 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+ }
123127 var body = bot . getDocument ( ) . body ;
124128 if ( body ) {
125129 bot . action . LegacyDevice_ . focusOnElement ( body ) ;
Original file line number Diff line number Diff line change 55 < script src ="test_bootstrap.js "> </ script >
66 < script type ="text/javascript ">
77 goog . require ( 'bot.action' ) ;
8+ goog . require ( 'bot.locators' ) ;
89 goog . require ( 'goog.Promise' ) ;
910 goog . require ( 'goog.Uri' ) ;
1011 goog . require ( 'goog.dom' ) ;
122123 expectBlurEvent ( e ) ;
123124 expectChangeEvent ( e ) ;
124125 bot . action . clear ( e ) ;
125- assertBlurFired ( ) ;
126+ if ( goog . userAgent . IE ) {
127+ assertBlurFired ( ) ;
128+ }
126129 assertChangeFired ( ) ;
127130 assertEquals ( '' , e . value ) ;
128131 } ) ;
197200 assertEquals ( "3" , goog . dom . forms . getValue ( e ) ) ;
198201 }
199202
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+
200212 function testSubmittingANonFormElementShouldResultInAnError ( ) {
201213 assertThrows ( goog . partial ( bot . action . submit , document . body ) ) ;
202214 }
300312 < div id ="child-not-content-editable "> child not content editable
301313 </ div >
302314 </ div >
315+ < iframe id ="iframe " src ="testdata/trusted_types_iframe.html ">
316+ </ iframe >
303317</ body >
304318</ 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