diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/old-tests/submission | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/old-tests/submission')
19 files changed, 960 insertions, 0 deletions
diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_002.html b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_002.html new file mode 100644 index 0000000000..fb6e44757d --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_002.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> + <head> + <title>HTML 5 Foreign Content SVG in HTML </title> + <meta description="Test to verify SVG inside HTML I element parses correctly" /> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <script type="text/javascript"> + + function RunTest() + { + try + { + + if(document.getElementsByTagName("i")[0].childNodes[1].localName=="svg") + { + var svgNamespace = "http://www.w3.org/2000/svg"; + var textElem = document.createElementNS(svgNamespace, "text"); + + var textContent = document.createTextNode("FillerText"); + textElem.appendChild(textContent); + + var container = document.getElementById("svg1"); + container.appendChild(textElem); + + } + } + catch(ex) + { + } + } + </script> + </head> + + <body onLoad="RunTest()"> + + <div class="testdata"> + <p id="instructions">Test passes if 'FillerText' is rendered as italic.</p> + </div> + <div> + <i> + <svg id="svg1" width="100px" height="100px"> + </svg> + </i> + </div> + + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_007.html b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_007.html new file mode 100644 index 0000000000..f1ba496bb0 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_007.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<svg width="100px" height="100px" > + <rect width="100px" height="100px" fill="green" /> +</svg> + +<div> + <p> Test passes if a green rectangle is visible on the page above this line. </p> +</div> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_012.html b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_012.html new file mode 100644 index 0000000000..bd8ab70f75 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_012.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> + <head> + <title>HTML 5 Foreign Content SVG in HTML </title> + <meta description="Test to verify SVG elements are styled using SCRIPT and STYLE element" /> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + + <style> + svg + { + display: block; + fill: black; + } + </style> + <script> + function ChangeColor() + { + document.getElementById("rect1").style.fill = "green"; + } + </script> + </head> + + <body onload="ChangeColor()"> + + <div class="testdata"> + <p id="instructions">Test passes if a green square appears above a black square. </p> + </div> + <svg width="200px" height="200px"> + <rect id="rect1" x="0" y="0" width="100px" height="100px" /> + <rect id="rect2" x="0" y="150" width="100px" height="100px" /> + </svg> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_014.html b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_014.html new file mode 100644 index 0000000000..0fc5f3fcdf --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_014.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html> + <head> + <title>HTML 5 Foreign Content SVG in HTML </title> + <meta description="Test to verify SVG elements inside SVG namespace are camelCased" /> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript"> + function RunTest() + { + var parentNode = document.getElementById("svg1"); + + for(var i=1;i<parentNode.childNodes.length;i=i+2) + { + var idName = parentNode.childNodes[i].id; + var localName = parentNode.childNodes[i].localName; + assert_equals(localName, idName); + } + } + </script> + </head> + + <body onload="test(RunTest)"> + + <svg id="svg1"> + + <altglyph id="altGlyph" /> + <ALTGLYPHDEF id="altGlyphDef" /> + <AltGlyphItem id="altGlyphItem" /> + <animatecolor id="animateColor" /> + <animatemotion id="animateMotion" /> + <animatetransform id="animateTransform" /> + <clippath id="clipPath" /> + <feblend id="feBlend" /> + <fecolormatrix id="feColorMatrix" /> + + <fecomponenttransfer id="feComponentTransfer" /> + <fecomposite id="feComposite" /> + <feconvolvematrix id="feConvolveMatrix" /> + <fediffuselighting id="feDiffuseLighting" /> + <fedisplacementmap id="feDisplacementMap" /> + <fedistantlight id="feDistantLight" /> + <feflood id="feFlood" /> + <fefunca id="feFuncA" /> + <fefuncb id="feFuncB" /> + + <fefuncg id="feFuncG" /> + <fefuncr id="feFuncR" /> + <fegaussianblur id="feGaussianBlur" /> + <feimage id="feImage" /> + <femerge id="feMerge" /> + <femergenode id="feMergeNode" /> + <femorphology id="feMorphology" /> + <feoffset id="feOffset" /> + <fepointlight id="fePointLight" /> + + <fespecularlighting id="feSpecularLighting" /> + <fespotlight id="feSpotLight" /> + <fetile id="feTile" /> + <feturbulence id="feTurbulence" /> + <foreignobject id="foreignObject" /> + <glyphref id="glyphRef" /> + <lineargradient id="linearGradient" /> + <radialgradient id="radialGradient" /> + <textpath id="textPath" /> + + </svg> + + </body> + +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_015.html b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_015.html new file mode 100644 index 0000000000..23d810a4f2 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/foreigncontent/foreign_content_015.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <title>HTML 5 Foreign Content SVG in HTML </title> + <meta description="Test to verify SVG Elements outside SVG namespace are camelCased" /> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript"> + function RunTest() + { + var parentNode = document.getElementById("div1"); + + for(var i=0;i<parentNode.childNodes.length;i++) + { + var idName = parentNode.childNodes[i].id; + var localName = parentNode.childNodes[i].localName; + assert_equals(localName, idName); + } + } + </script> + </head> + + <body onload="test(RunTest)"> + + <div id="div1"> + <AlTglYph id="altGlyph" /> + </div> + + </body> + +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/history/history_000.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/history/history_000.htm new file mode 100644 index 0000000000..0e335c7deb --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/history/history_000.htm @@ -0,0 +1,340 @@ +<!doctype html> +<html> + <head> + <meta content="text/html; charset=utf-8" http-equiv="content-type" /> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <link rel="help" href="http://dev.w3.org/html5/spec/history.html" /> + <title>HTML5 History Test Cases</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> +<body> + <div id="log"></div> + + <!-- Use this iframe to test url changes so that the base url does not change. Their document does not matter. --> + <iframe id="testframe1" style="display:none" src="/common/blank.html"></iframe> + <iframe id="testframe2" style="display:none" src="/common/blank.html"></iframe> + + <script type="text/javascript"> + var testCollection; + var testIndex = 0; + var testframe1 = document.getElementById("testframe1"); + var testframe2 = document.getElementById("testframe2"); + + setup(function() + { + testCollection = [ + function() { + test(function() { + assert_own_property(window, "onpopstate", "window has 'onpopstate' own property"); + }, "onpopstate in window"); + }, + function() { + test(function() { + assert_inherits(window.history, "pushState", "history inherits property 'pushState'"); + assert_equals(window.history.pushState.constructor, Function, "pushState is a function"); + }, "history.pushState is present"); + }, + function() { + test(function() { + assert_inherits(window.history, "replaceState", "history inherits property 'replaceState'"); + assert_equals(window.history.replaceState.constructor, Function, "replaceState is a function"); + }, "history.replaceState is present"); + }, + function() { + test(function() { + assert_inherits(window.history, "state", "history inherits property 'state'"); + }, "history.state is present"); + }, + function() { + test(function() { + assert_equals(window.history.state, null, "history.state initialized to null"); + }, "history.state is initialized to null"); + }, + + function() { + test(function() { + var length = history.length; + history.pushState(null,null); + assert_equals(history.length, length+1, "history.length should be incremented by one"); + }, "history.pushState increments history.length"); + }, + + function() { + var t = async_test("history.pushState clears forward entries"); + t.step(function() { + var length = history.length; + //push some extra entries into the session history + history.pushState(null,null); + history.pushState(null, null); + history.pushState(null, null); + + //there should now be three extra + assert_equals(history.length, length+3, "Three additional travel entries add to history.length"); + + let popstateCount = 0; + onpopstate = t.step_func(function(e) { + if (++popstateCount == 3) { + onpopstate = null; + //once the .back navigations have completed, push again and verify length is one more than starting value + history.pushState(null, null); + assert_equals(history.length, length+1, "History.length should now only be one more than original value"); + t.done(); + } + }); + //travel back to the entry that the test started on + history.back(); + history.back(); + history.back(); + }); + }, + + function() { + test(function() { + testframe1.contentWindow.history.pushState(null,null, "test-pushstate-url"); + assert_equals(getPageName(testframe1.contentWindow.location.href), "test-pushstate-url", "iframe1 has the pushed url"); + }, "history.pushState accepts a third parameter 'url' and uses it to alter location"); + }, + function() { + test(function() { + var oldurl = testframe1.contentWindow.location.href.toString(); + var pagename = getPageName(oldurl); + //form a new absolute url (with protocol, host, etc) with "absolute-page" as the name of the page + var newurl = oldurl.replace(pagename, "absolute-page"); + + testframe1.contentWindow.history.pushState(null,null, newurl); + assert_equals(testframe1.contentWindow.location.href, newurl, "iframe1 has the pushed url correctly"); + }, "history.pushState's url parameter can be an absolute url"); + }, + + function() { + test(function() { + testframe1.contentWindow.history.pushState(null,null, "multiple-pushstate-url1"); + testframe2.contentWindow.history.pushState(null,null, "multiple-pushstate-url2"); + + assert_equals(getPageName(testframe1.contentWindow.location.href), "multiple-pushstate-url1", "iframe1 has the pushed url"); + assert_equals(getPageName(testframe2.contentWindow.location.href), "multiple-pushstate-url2", "iframe2 has the pushed url"); + }, "history.pushState can modify location object in multiple frames"); + }, + + function() { + test(function() { + //trigger a security error by replacing the host of the current url with a fake one that is cross-domain + var testurl = testframe1.contentWindow.location.href.toString().replace(testframe1.contentWindow.location.host, "fakelocation-push"); + assert_throws_dom("SECURITY_ERR", function() { history.pushState(null, null, testurl); }, "Security_Err 18 should be thrown"); + }, "history.pushState throws DOMException with code SECURITY_ERR (18)"); + }, + + function() { + test(function() { + //trigger a data clone error by passing invalid SCA data into the function + assert_throws_dom("DATA_CLONE_ERR", function() { history.pushState(document.body, null); }, "pushState should throw an exception DATA_CLONE_ERR with code 25"); + }, "history.pushState throws DATA_CLONE_ERR(25) for bad state parameter"); + }, + + function() { + test(function() { + var length = history.length; + history.replaceState(null,null); + assert_equals(history.length, length, "history.length should not change"); + }, "history.replaceState does not increment history.length"); + }, + + function() { + var t = async_test("history.replaceState does not clear forward entries"); + t.step(function() { + var length = history.length; + //push some extra entries into the session history + history.pushState(null,null); + history.pushState(null, null); + history.pushState(null, null); + + //there should now be three extra + assert_equals(history.length, length+3, "Three additional travel entries add to history.length"); + + let popstateCount = 0; + onpopstate = t.step_func(function(e) { + if (++popstateCount == 2) { + onpopstate = null; + //once the .back navigations have fired, replace and verify the length has not changed since the last check + history.replaceState(null, null); + assert_equals(history.length, length+3, "History.length should still be three more than original value"); + t.done(); + } + }); + + //travel back two entries to land in the middle + history.back(); + history.back(); + }); + }, + + function() { + test(function() { + testframe1.contentWindow.history.replaceState(null,null, "test-replaceState-url"); + assert_equals(getPageName(testframe1.contentWindow.location.href), "test-replaceState-url", "iframe1 has the pushed url"); + }, "history.replaceState accepts a third parameter 'url' and uses it to alter location"); + }, + function() { + test(function() { + var oldurl = testframe1.contentWindow.location.href.toString(); + var pagename = getPageName(oldurl); + //form a new absolute url (with protocol, host, etc) with "absolute-page" as the name of the page + var newurl = oldurl.replace(pagename, "absolute-page"); + + testframe1.contentWindow.history.replaceState(null,null, newurl); + assert_equals(testframe1.contentWindow.location.href, newurl, "iframe1 has the pushed url correctly"); + }, "history.replaceState's url parameter can be an absolute url"); + }, + + function() { + test(function() { + testframe1.contentWindow.history.replaceState(null,null, "multiple-replaceState-url1"); + testframe2.contentWindow.history.replaceState(null,null, "multiple-replaceState-url2"); + + assert_equals(getPageName(testframe1.contentWindow.location.href), "multiple-replaceState-url1", "iframe1 has the pushed url"); + assert_equals(getPageName(testframe2.contentWindow.location.href), "multiple-replaceState-url2", "iframe2 has the pushed url"); + }, "history.replaceState can modify location object in multiple frames"); + }, + + function() { + test(function() { + //trigger a security error by replacing the host of the current url with a fake one that is cross-domain + var testurl = testframe1.contentWindow.location.href.toString().replace(testframe1.contentWindow.location.host, "fakelocation-replace"); + assert_throws_dom("SECURITY_ERR", function() { history.replaceState(null, null, testurl); }, "Security_Err 18 should be thrown"); + }, "history.replaceState throws DOMException with code SECURITY_ERR (18)"); + }, + + function() { + test(function() { + //trigger a data clone error by passing invalid SCA data into the function + assert_throws_dom("DATA_CLONE_ERR", function() {history.replaceState(document.body, null);}, "replaceState should throw an exception DATA_CLONE_ERR with code 25"); + }, "history.replaceState throws DATA_CLONE_ERR(25) for bad state parameter"); + }, + + function() { + var t = async_test("PopStateEvent fires on Back navigation"); + t.step(function() { + history.pushState(null, null); + history.pushState(null, null); + //prepare to end the test as soon as popstate fires + onpopstate = function(e) { + t.done(); + } + //go back to fire the popstate event + history.back(); + }); + }, + + function() { + var t = async_test("PopStateEvent fires on Forward navigation"); + t.step(function() { + onpopstate = null; + history.pushState(null, null); + history.pushState(null, null); + onpopstate = function(e) { + //prepare to end the test as soon as popstate fires + onpopstate = function(e) { + t.done(); + }; + //go forward to fire the popstate event + history.forward(); + }; + history.back(); + }); + }, + + function() { + var t = async_test("PopStateEvent receives state data on Back navigation"); + t.step(function() { + history.pushState("popstate-data", null); + history.pushState(null, null); + //prepare the popstate event to validate the data + onpopstate = t.step_func(function(e) { + assert_equals(e.state, "popstate-data", "State data is passed to the event correctly"); + t.done(); + }); + //go back to fire the popstate event + history.back(); + }); + }, + + function() { + test(function() { + history.pushState("pushstate-data", null); + //history.state should be set immediately + assert_equals(history.state, "pushstate-data", "State data is set correctly"); + }, "history.state is set by history.pushState"); + }, + + function() { + test(function() { + history.replaceState("replacestate-data", null); + //history.state should be set immediately + assert_equals(history.state, "replacestate-data", "State data is set correctly"); + }, "history.state is set by history.replaceState"); + }, + + function() { + var t = async_test("history.state changes on navigation"); + t.step(function() { + history.pushState("state-back1", null); + history.pushState("state-back2", null); + //precondition + assert_equals(history.state, "state-back2", "Verify that history.state is set to a second value"); + + //set up the popstate event to verify that history.state was changed + onpopstate = t.step_func(function(e) { + assert_equals(e.state, "state-back1", "Verify that history.state reverted to the first value"); + t.done(); + }); + history.back(); + }); + }, + ]; + }, {explicit_done:true, timeout:8000}); + + //used to get the name of a page within a path + // to check correctness of url parameter + function getPageName(path) { + var path = path || location.pathname; + var segments = path.split('/'); + return segments[segments.length-1]; + } + + //Callback for result_callback + //queues the next test in the array testCollection + //serves to make test execution sequential despite asynchronous behaviors + function testFinished(test) { + if(testIndex < testCollection.length - 1) { + //Run the function asynchronously so that the stack remains shallow + setTimeout(testCollection[++testIndex]); + } else { + //when the last test has run, explicitly end test suite + done(); + } + } + + add_result_callback(testFinished); + + function startTestsWhenIframesLoaded() { + if (testframe1.contentWindow.document.readyState != 'complete' || + testframe2.contentWindow.document.readyState != 'complete') { + return; + } + testframe1.removeEventListener('load', startTestsWhenIframesLoaded, false); + testframe2.removeEventListener('load', startTestsWhenIframesLoaded, false); + + //start the first test + setTimeout(testCollection[testIndex]); + } + + // add listeners to trigger the tests once the iframes are loaded, + // but also try to start it right away in case the load events have + // already fired and we missed them. + testframe1.addEventListener('load', startTestsWhenIframesLoaded, false); + testframe2.addEventListener('load', startTestsWhenIframesLoaded, false); + startTestsWhenIframesLoaded(); + </script> +</body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/RemoveElementContainingSelection.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/RemoveElementContainingSelection.htm new file mode 100644 index 0000000000..1286493a3e --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/RemoveElementContainingSelection.htm @@ -0,0 +1,29 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Remove the element containing the selection</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var div1 = document.getElementById("div1"); + var span1 = document.getElementById("span1"); + var range = document.createRange(); + range.selectNode(span1); + selection.addRange(range); + + assert_equals(selection.toString(), span1.textContent); + document.body.removeChild(div1); + assert_equals(selection.toString(), ""); + } + </script> + </head> + <body onload="test(RunTest);"> + <div id="div1">some text + <span id="span1">aaaaaaaa</span> + </div> + <div id="div2">Remove the element containing the selection</div> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/collapseToEnd.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/collapseToEnd.htm new file mode 100644 index 0000000000..3a93d52ce0 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/collapseToEnd.htm @@ -0,0 +1,31 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Collapse the selection with collapseToEnd()</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var p1 = document.getElementById("p1"); + + var range = document.createRange(); + range.selectNode(p1); + selection.addRange(range); + + checkSelectionAttributes(document.body, 1, document.body, 2, false, 1); + assert_equals(selection.toString(), p1.textContent); + + selection.collapseToEnd(); + + checkSelectionAttributes(document.body, 2, document.body, 2, true, 1); + assert_equals(selection.toString(), ""); + } + </script> + </head> + <body onload="test(RunTest);"> + <p id="p1">Collapse the selection with collapseToEnd()</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/collapseToStart.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/collapseToStart.htm new file mode 100644 index 0000000000..d24cbae8f5 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/collapseToStart.htm @@ -0,0 +1,31 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Collapse the selection with collapseToStart()</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var p1 = document.getElementById("p1"); + + var range = document.createRange(); + range.selectNode(p1); + selection.addRange(range); + + checkSelectionAttributes(document.body, 1, document.body, 2, false, 1); + assert_equals(selection.toString(), p1.textContent); + + selection.collapseToStart(); + + checkSelectionAttributes(document.body, 1, document.body, 1, true, 1); + assert_equals(selection.toString(), "") + } + </script> + </head> + <body onload="test(RunTest);"> + <p id="p1">Collapse the selection with collapseToStart()</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/common.js b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/common.js new file mode 100644 index 0000000000..6da739b5eb --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/common.js @@ -0,0 +1,15 @@ +function checkSelectionAttributes(anchorNode, anchorOffset, focusNode, focusOffset, collapsed, rangeCount) +{ + var selection = window.getSelection(); + assert_equals(selection.anchorNode, anchorNode, "anchorNode"); + assert_equals(selection.anchorOffset, anchorOffset, "anchorOffset"); + assert_equals(selection.focusNode, focusNode, "focusNode"); + assert_equals(selection.focusOffset, focusOffset, "focusOffset"); + assert_equals(selection.isCollapsed, collapsed, "collapsed"); + assert_equals(selection.rangeCount, rangeCount, "rangeCount"); +} + +function checkDefaultSelectionAttributes() +{ + checkSelectionAttributes(null, 0, null, 0, true, 0); +} diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/deleteFromDocument.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/deleteFromDocument.htm new file mode 100644 index 0000000000..b9ae112275 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/deleteFromDocument.htm @@ -0,0 +1,33 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Delete some text from the document while it is part of a selection</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var p2 = document.getElementById("p2"); + + var range = document.createRange(); + range.setStart(p2.firstChild, 5); + range.setEnd(p2.firstChild, 20); + selection.addRange(range); + + checkSelectionAttributes(p2.firstChild, 5, p2.firstChild, 20, false, 1); + assert_equals(p2.firstChild.data, p2.textContent) + + selection.deleteFromDocument(); + + checkSelectionAttributes(p2.firstChild, 5, p2.firstChild, 5, true, 1); + assert_equals(p2.firstChild.data, "abcdeuvwxyz") + } + </script> + </head> + <body onload="test(RunTest);"> + <p id="p1">Delete some text from the document while it is part of a selection</p> + <p id="p2">abcdefghijklmnopqrstuvwxyz</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/getRangeAt.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/getRangeAt.htm new file mode 100644 index 0000000000..d323e7d71c --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/getRangeAt.htm @@ -0,0 +1,30 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Get the range from the selection</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var p1 = document.getElementById("p1"); + + var range = document.createRange(); + range.selectNode(p1); + selection.addRange(range); + + var returnedRange = selection.getRangeAt(0); + + assert_equals(returnedRange.toString(), p1.textContent); + assert_equals(returnedRange.startContainer, document.body); + assert_equals(returnedRange.startOffset, 1); + assert_equals(returnedRange.endContainer, document.body); + assert_equals(returnedRange.endOffset, 2); + } + </script> + </head> + <body onload="test(RunTest);"> + <p id="p1">Get the range from the selection</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/insertNodeIntoSelection.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/insertNodeIntoSelection.htm new file mode 100644 index 0000000000..4ac8702a0e --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/insertNodeIntoSelection.htm @@ -0,0 +1,31 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Insert a new element and text node into an element that is currently selected</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var div1 = document.getElementById("div1"); + var range = document.createRange(); + range.selectNode(div1); + selection.addRange(range); + + assert_equals(selection.toString(), "some text"); + + var ele = document.createElement("div"); + var tNode = document.createTextNode("new text"); + ele.appendChild(tNode); + div1.appendChild(ele); + + assert_equals(selection.toString(), "some text\nnew text"); + } + </script> + </head> + <body onload="test(RunTest);"> + <p>This test inserts a new element with a text node child into the current selection.</p> + <div id="div1">some text</div> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeAllRanges.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeAllRanges.htm new file mode 100644 index 0000000000..85d6211e1c --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeAllRanges.htm @@ -0,0 +1,31 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Call removeAllRanges() to clear the selection</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var p1 = document.getElementById("p1"); + + var range = document.createRange(); + range.selectNode(p1); + selection.addRange(range); + + checkSelectionAttributes(document.body, 1, document.body, 2, false, 1); + assert_equals(selection.toString(), p1.textContent); + + selection.removeAllRanges(); + + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + } + </script> + </head> + <body onload="test(RunTest);"> + <p id="p1">Call removeAllRanges() to clear the selection</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeRange.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeRange.htm new file mode 100644 index 0000000000..8786e82671 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/removeRange.htm @@ -0,0 +1,31 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Remove the range from the selection</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var p1 = document.getElementById("p1"); + + var range = document.createRange(); + range.selectNode(p1); + selection.addRange(range); + + checkSelectionAttributes(document.body, 1, document.body, 2, false, 1); + assert_equals(selection.toString(), p1.textContent); + + selection.removeRange(range); + + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + } + </script> + </head> + <body onload="test(RunTest);"> + <p id="p1">Remove the range from the selection by calling removeRange()</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/select.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/select.htm new file mode 100644 index 0000000000..98086ef189 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/select.htm @@ -0,0 +1,32 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Call select() on a text field</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var input1 = document.getElementById("input1"); + + assert_equals(input1.selectionStart, 0); + assert_equals(input1.selectionEnd, 0); + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + + input1.select(); + + assert_equals(input1.selectionStart, 0); + assert_equals(input1.selectionEnd, input1.value.length); + checkSelectionAttributes(document.body, 1, document.body, 1, true, 1); + assert_equals(selection.toString(), input1.value); + } + </script> + </head> + <body onload="test(RunTest);"> + <input style="WIDTH: 500px" id="input1" value="Some text in an input control" type="text" /> + <p>Select the text in the input element by calling select()</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/selectAllChildren.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/selectAllChildren.htm new file mode 100644 index 0000000000..8f0d7c81b9 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/selectAllChildren.htm @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Call selectAllChildren() where the parameter is a text node</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var div1 = document.getElementById("div1"); + + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + + selection.selectAllChildren(div1.firstChild); + + checkSelectionAttributes(div1.firstChild, 0, div1.firstChild, 0, true, 1); + assert_equals(selection.toString(), ""); + } + </script> + </head> + <body onload="test(RunTest);"> + <div id="div1">Call selectAllChildren() where the parameter is a text node</div> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/selectionStartEnd.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/selectionStartEnd.htm new file mode 100644 index 0000000000..35687f4a5a --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/selectionStartEnd.htm @@ -0,0 +1,54 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Set selectionStart and selectionEnd on a text field</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var input1 = document.getElementById("input1"); + + assert_equals(input1.selectionStart, 0); + assert_equals(input1.selectionEnd, 0); + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + + // only setting selectionStart/End doesn't affect getSelection() + + input1.selectionStart = 5; + input1.selectionEnd = 9; + + assert_equals(input1.selectionStart, 5); + assert_equals(input1.selectionEnd, 9); + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + + // select() changes selectionStart/End and getSelection() + + input1.select(); + + assert_equals(input1.selectionStart, 0); + assert_equals(input1.selectionEnd, input1.value.length); + checkSelectionAttributes(document.body, 1, document.body, 1, true, 1); + assert_equals(selection.toString(), input1.value); + + // now setting selectionStart/End does affect getSelection() + + input1.selectionStart = 5; + input1.selectionEnd = 9; + + assert_equals(input1.selectionStart, 5); + assert_equals(input1.selectionEnd, 9); + checkSelectionAttributes(document.body, 1, document.body, 1, true, 1); + assert_equals(selection.toString(), "text"); + } + </script> + </head> + <body onload="test(RunTest);"> + <input style="WIDTH: 500px" id="input1" value="Some text in an input control" type="text" /> + <p>Select some text in the input element by setting selectionStart and selectionEnd</p> + </body> +</html> diff --git a/testing/web-platform/tests/old-tests/submission/Microsoft/selection/setSelectionRange.htm b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/setSelectionRange.htm new file mode 100644 index 0000000000..8de7fe5eb4 --- /dev/null +++ b/testing/web-platform/tests/old-tests/submission/Microsoft/selection/setSelectionRange.htm @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> + <head> + <title id="desc">HTML5 Selection: Call setSelectionRange() on a text field</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="common.js"></script> + <script type="text/javascript"> + function RunTest() + { + var selection = window.getSelection(); + var input1 = document.getElementById("input1"); + var expectedResult = "input"; + + assert_equals(input1.selectionStart, 0); + assert_equals(input1.selectionEnd, 0); + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + + // only calling setSelectionRange() doesn't affect getSelection() + + input1.setSelectionRange(16, 21); + + assert_equals(input1.selectionStart, 16); + assert_equals(input1.selectionEnd, 21); + checkDefaultSelectionAttributes(); + assert_equals(selection.toString(), ""); + + // select() changes selectionStart/End and getSelection() + + input1.select(); + + assert_equals(input1.selectionStart, 0); + assert_equals(input1.selectionEnd, input1.value.length); + checkSelectionAttributes(document.body, 1, document.body, 1, true, 1); + assert_equals(selection.toString(), input1.value); + + // now calling setSelectionRange() does affect getSelection() + + input1.setSelectionRange(16, 21); + + assert_equals(input1.selectionStart, 16); + assert_equals(input1.selectionEnd, 21); + checkSelectionAttributes(document.body, 1, document.body, 1, true, 1); + assert_equals(selection.toString(), "input"); + } + </script> + </head> + <body onload="test(RunTest);"> + <input style="WIDTH: 500px" id="input1" value="Some text in an input control" type="text" /> + <p>Call setSelectionRange() on the input element to select some of the text</p> + </body> +</html> |