Commit 6a123e7b authored by yosin's avatar yosin Committed by Commit bot

Convert editing/execCommand/format-block-contenteditable-false.html to utilize w3c test harness

This patch converts "format-block-converts-false.html" to utilize w3c test
harness with |assert_selection()| to simplify test case for improving code
health.

This patch is as preparation of http://crrev.com/2532373002

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

Review-Url: https://codereview.chromium.org/2550633002
Cr-Commit-Position: refs/heads/master@{#436226}
parent 1e9cfa73
formatblock on selection with a contenteditable="false" child.
| <h1>
| <i>
| "
<#selection-anchor>Will select from here
"
| <br>
| <i>
| "
until here.<#selection-focus>
"
| <div>
| contenteditable="false"
| "
over this contenteditable=false div
"
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/dump-as-markup.js"></script>
</head>
<body>
<div id="editorcontainer" contenteditable="true">
Will select from here
<div contenteditable="false">
over this contenteditable=false div
</div>
until here.
</div>
</body>
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
Markup.description('formatblock on selection with a contenteditable="false" child.');
var selection = window.getSelection();
selection.removeAllRanges();
var container = document.getElementById('editorcontainer');
var range = document.createRange()
range.setStartBefore(container.firstChild);
range.setEndAfter(container.lastChild);
selection.addRange(range);
document.execCommand('italic', false, "");
document.execCommand('formatblock', false, "<h1>");
Markup.dump(container);
test(() => assert_selection(
[
'<div contenteditable>',
' ^Will select from here',
' <div contenteditable="false">',
' over this contenteditable=false div',
' </div>',
' until here.|',
'</div>',
].join('\n'),
selection => {
selection.document.execCommand('italic');
selection.document.execCommand('formatblock', false, '<h1>');
},
[
'<div contenteditable><h1><i>',
' ^Will select from here',
' </i><br><i>',
' until here.|',
'</i></h1><div contenteditable="false">',
' over this contenteditable=false div',
' </div></div>',
].join('\n')),
'formatBlock with uneditable');
</script>
</html>
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