Commit 8521c4eb authored by yosin's avatar yosin Committed by Commit bot

Makes assert_selection() to set focus to sample IFRAME

This patch makes |assert_selection()| to set focus to sample IFRAME to ensure
|eventSender| and |testRunner.execCommand()| to work on sample IFRAME rather
than main frame.

The expectation sample of "editing/deleting/delete_by_word.html" is changed to
"Ctrl+Backspace", delete by word, deletes word before caret. Before this
patch, "Ctrl+Backspace" was sent to main frame and sample IFRAME didn't handle
it and did nothing.

BUG=n/a
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2341563003
Cr-Commit-Position: refs/heads/master@{#418524}
parent 029a4964
......@@ -554,6 +554,9 @@ class Sample {
this.selection_.document.offsetTop = this.iframe_.offsetTop;
this.selection_.setClipboardData = setClipboardData;
// Set focus to sample IFRAME to make |eventSender| and
// |testRunner.execCommand()| to work on sample rather than main frame.
this.iframe_.focus();
this.load(sampleText);
}
......
......@@ -19,10 +19,9 @@
eventSender.keyDown('Backspace', kDeleteWordModifiers);
selection.document.execCommand('insertText', false, ' cha');
},
// BR is a placeholder.
[
'<div contenteditable>',
'one two \u{00A0}abc cha|cha cha three four cha cha cha',
'one two \u{00A0} cha|cha cha three four cha cha cha',
'</div>',
].join(''));
}, 'Delete word');
......@@ -39,10 +38,11 @@
eventSender.keyDown('Backspace', kDeleteWordModifiers);
selection.document.execCommand('undo');
},
// BR is a placeholder.
[
'<div contenteditable>',
'one two |three four',
isMac
? 'one |two ^three four'
: 'one two |three four',
'</div>',
].join(''));
}, 'Delete word then undo');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment