Skip to content

Commit

Permalink
Convert 2 Microsoft SVG-in-HTML tests to testharness.js (web-platform…
Browse files Browse the repository at this point in the history
…-tests#7758)

That's 014 and 015. Drive-by whitespace changes in 002 and 012.
  • Loading branch information
foolip authored Oct 13, 2017
1 parent d9869ef commit f81aa44
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 80 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE html >
<!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/" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<script type="text/javascript">

function RunTest()
{
try
Expand All @@ -15,7 +15,7 @@
{
var svgNamespace = "http://www.w3.org/2000/svg";
var textElem = document.createElementNS(svgNamespace, "text");

var textContent = document.createTextNode("FillerText");
textElem.appendChild(textContent);

Expand All @@ -25,7 +25,7 @@
}
}
catch(ex)
{
{
}
}
</script>
Expand All @@ -38,7 +38,7 @@
</div>
<div>
<i>
<svg id="svg1" width="100px" height="100px">
<svg id="svg1" width="100px" height="100px">
</svg>
</i>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<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/" />
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />

<style>
svg
{
Expand All @@ -19,7 +19,7 @@
}
</script>
</head>

<body onload="ChangeColor()">

<div class="testdata">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,25 @@
<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()
{
try
{
var bResult = "FAIL";
var parentNode = document.getElementById("svg1");

for(var i=1;i<parentNode.childNodes.length;i=i+2)
{
var idName = parentNode.childNodes[i].id;
var tagName = parentNode.childNodes[i].localName;
if(idName!=tagName)
{
bResult = "FAIL";
break;
}
else
{
bResult = "PASS"
}
}
}
catch(ex)
var parentNode = document.getElementById("svg1");

for(var i=1;i<parentNode.childNodes.length;i=i+2)
{
bResult = "PASS";
var idName = parentNode.childNodes[i].id;
var localName = parentNode.childNodes[i].localName;
assert_equals(localName, idName);
}

document.getElementById("testresult").innerHTML = bResult;
}
</script>
</head>

<body onload="RunTest()">

<div class="testdata">
<p id="instructions"> Test passes if the word "PASS" appears below </p>
<p> Test Result : </p>
<p id="testresult"> RUNNING </div>
</div>
<body onload="test(RunTest)">

<svg id="svg1">

<altglyph id="altGlyph" />
Expand Down Expand Up @@ -88,11 +65,8 @@
<radialgradient id="radialGradient" />
<textpath id="textPath" />

</svg>

</svg>


</body>

</html>

Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,30 @@
<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/" />

<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()
{
try
{

var parentNode = document.getElementById("div1");

for(var i=0;i<parentNode.childNodes.length;i++)
{
var idName = parentNode.childNodes[i].id;
var tagName = parentNode.childNodes[i].localName;
if(idName==tagName)
{
document.getElementById("testresult").innerHTML = "FAIL";
break;
}
else
{
document.getElementById("testresult").innerHTML = "PASS";
}
}
}
catch(ex)
var parentNode = document.getElementById("div1");

for(var i=0;i<parentNode.childNodes.length;i++)
{
document.getElementById("testresult").innerHTML = "FAIL";
var idName = parentNode.childNodes[i].id;
var localName = parentNode.childNodes[i].localName;
assert_equals(localName, idName);
}
}
</script>
</head>
<body onload="RunTest()">

<body onload="test(RunTest)">

<div id="div1">
<AlTglYph id="altGlyph" />
</div>
<p id="instructions"> Test passes if the word "PASS" appears below </p>
<p> Test Result : </p>
<div id="testresult"> RUNNING </div>


</div>

</body>

</html>

0 comments on commit f81aa44

Please sign in to comment.