Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / apply-style-id-name.html
blob09538fdb253c11f97742a9426f682cc8dca07d8a
1 <script src="../../resources/js-test.js"></script>
2 <div id="console"></div>
3 <script>
4 function testPartialSelection(initialContents, expectedContents, command, argument) {
5 testContainer.innerHTML = initialContents;
6 var selection = window.getSelection();
7 selection.collapse(testContainer, 0);
8 selection.modify("move", "forward", "character");
9 selection.extend(selection.focusNode, 3)
10 document.execCommand(command, false, argument);
11 if (testContainer.innerHTML === expectedContents) {
12 testPassed(command + " command converted " + initialContents + " to " + expectedContents);
13 } else {
14 testFailed(command + " command converted " + initialContents + " to " + testContainer.innerHTML + ", expected " + expectedContents);
18 var testContainer = document.createElement("div");
19 testContainer.contentEditable = true;
20 document.body.appendChild(testContainer);
22 testPartialSelection('<a id="abc"><b>fbabaz</b></a>', '<b><a id="abc">f</a><a href="http://www.google.com">ba</a><a>baz</a></b>', 'createLink', 'http://www.google.com');
23 testPartialSelection('<a name="abc"><b>fbabaz</b></a>', '<b><a name="abc">f</a><a href="http://www.google.com">ba</a><a>baz</a></b>', 'createLink', 'http://www.google.com');
24 testPartialSelection('<a id="abc" name="abc"><b>fbabaz</b></a>', '<b><a id="abc" name="abc">f</a><a href="http://www.google.com">ba</a><a>baz</a></b>', 'createLink', 'http://www.google.com');
26 testPartialSelection('<a id="abc"><b>fbabaz</b></a>', '<b><a id="abc">f</a>ba<a>baz</a></b>', 'unlink');
27 testPartialSelection('<a name="abc"><b>fbabaz</b></a>', '<b><a name="abc">f</a>ba<a>baz</a></b>', 'unlink');
28 testPartialSelection('<a id="abc" name="abc"><b>fbabaz</b></a>', '<b><a id="abc" name="abc">f</a>ba<a>baz</a></b>', 'unlink');
30 testPartialSelection('<span id="abc" name="abc"><b>fbabaz</b></span>', '<span id="abc" name="abc"><b>f<a href="http://www.google.com">ba</a>baz</b></span>', 'createLink', 'http://www.google.com');
32 document.body.removeChild(testContainer);
33 var successfullyParsed = true;
34 </script>