DescriptionIntroduce selection.setClipboardData() in assert_selection()
This patch introduces |selection.setClipboardData(html, opt_text)| in
|assert_selection()| to write "paste" command test scripts without
executing "copy" command for improving test scripts isolation.
Before this patch, we should write a test case as:
assert_selection(
'<div contenteditable>^foo|</div>',
selection => {
selection.document.execCommand('copy');
// Replace existing selection; we can't observe changes
selection.document.execCommand('paste');
selection.document.execCommand('paste');
},
'<div contenteditable>^foofoo|</div>');
After this patch, we would write as:
assert_selection(
'<div contenteditable>|</div>',
selection => {
selection.setClipboardData('<b>foo</b>');
selection.document.execCommand('paste');
},
'<div contenteditable><b>foo|</b></div>');
BUG=n/a
TEST=LayoutTests/editing/assert_selection.html
Committed: https://crrev.com/6a0e2eab9d3516ed5fe676ff646a9ed7a6bd4aa9
Cr-Commit-Position: refs/heads/master@{#416165}
Patch Set 1 : 2016-09-01T18:36:42 #
Messages
Total messages: 16 (11 generated)
|