Bug 1559369 [wpt PR 17345] - Add more direction tests, a=testonly

Automatic update from web-platform-tests
Add more direction tests (#17345)

* Add more direction tests

Put these in a new directory.

* Make direction.html use testharness.js

--

wpt-commits: fdf8ff01960e031fe0381133f5a39e1b8e372454
wpt-pr: 17345
This commit is contained in:
Rob Buis 2019-07-19 12:12:58 +00:00 коммит произвёл James Graham
Родитель e522cc90e9
Коммит c8f49e7cff
5 изменённых файлов: 193 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Verify dir attribute on various containers</title>
</head>
<body>
<p>
math:
<math>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</math>
</p>
<p>
mrow:
<math>
<mrow>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</mrow>
</math>
</p>
<p>
mstyle:
<math>
<mstyle>
<mspace width="25px" height="25px" mathbackground="blue"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="red"/>
</mstyle>
</math>
</p>
<p>
msqrt:
<math>
<msqrt>
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</msqrt>
</math>
</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Verify dir attribute on various containers</title>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
<meta name="assert" content="Verify dir attribute on various containers.">
<link rel="match" href="direction-overall-ref.html">
</head>
<body>
<!-- Test dir="rtl" on <math>, <mrow> and <mstyle> elements. The rectangle
inside these elements should be displayed right-to-left. -->
<p>
math:
<math dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</math>
</p>
<p>
mrow:
<math>
<mrow dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</mrow>
</math>
</p>
<p>
mstyle:
<math>
<mstyle dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</mstyle>
</math>
</p>
<!-- dir="rtl" on <msqrt> should be ignored. The rectangle
inside this element should be displayed left-to-right. -->
<p>
msqrt:
<math>
<msqrt dir="rtl">
<mspace width="25px" height="25px" mathbackground="red"/>
<mspace width="25px" height="25px" mathbackground="green"/>
<mspace width="25px" height="25px" mathbackground="blue"/>
</msqrt>
</math>
</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html dir="rtl">
<head>
<meta charset="utf-8"/>
<title>Verify dir attribute on token elements</title>
</head>
<body>
<!-- Test dir="rtl" on MathML token elements. The text contains RTL and
LTR characters, so the attribute is needed to specify the actual
direction. -->
<p><math><mtext dir="rtl">חוק \left חסר או חוק \right מיותר</mtext></math></p>
<p><math><ms dir="rtl">חוק \left חסר או חוק \right מיותר</ms></math></p>
<p><math><mo dir="rtl">חוק \left חסר או חוק \right מיותר</mo></math></p>
<p><math><mi dir="rtl">חוק \left חסר או חוק \right מיותר</mi></math></p>
<p><math><mn dir="rtl">חוק \left חסר או חוק \right מיותר</mn></math></p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html dir="rtl">
<head>
<meta charset="utf-8"/>
<title>Verify dir attribute on token elements</title>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
<meta name="assert" content="Verify dir attribute on various token elements.">
<link rel="match" href="direction-token-ref.html">
</head>
<body>
<!-- Test dir="rtl" on MathML token elements. The text contains RTL and
LTR characters, so the attribute is needed to specify the actual
direction. -->
<p><math><mtext dir="rtl">חוק \left חסר או חוק \right מיותר</mtext></math></p>
<p><math><ms dir="rtl">חוק \left חסר או חוק \right מיותר</ms></math></p>
<p><math><mo dir="rtl">חוק \left חסר או חוק \right מיותר</mo></math></p>
<p><math><mi dir="rtl">חוק \left חסר או חוק \right מיותר</mi></math></p>
<p><math><mn dir="rtl">חוק \left חסר או חוק \right מיותר</mn></math></p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html dir="rtl">
<head>
<meta charset="utf-8"/>
<title>Verify computed direction</title>
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
<meta name="assert" content="Verify computed direction value.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({ explicit_done: true });
window.addEventListener("load", runTests);
function runTests() {
test(function() {
assert_equals(window.getComputedStyle(document.getElementById('x1')).direction, "ltr");
assert_equals(window.getComputedStyle(document.getElementById('x2')).direction, "ltr");
assert_equals(window.getComputedStyle(document.getElementById('x3')).direction, "ltr");
assert_equals(window.getComputedStyle(document.getElementById('x4')).direction, "rtl");
}, "Check direction");
done();
}
</script>
</head>
<body>
<!-- Test the CSS direction and dir attribute on the <math> element. It
should be "ltr", except if an explicit dir="rtl" is used. -->
<p>שורשי משוואה מודגשת זו <math id="x1"> <mstyle mathvariant="bold"> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mstyle> </math> מודגשים גם הם</p>
<p>שורשי משוואה מודגשת זו <math id="x2" dir="ltr"> <mstyle mathvariant="bold"> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mstyle> </math> מודגשים גם הם</p>
<p>שורשי משוואה מודגשת זו <math id="x3" dir="invalid"> <mstyle mathvariant="bold"> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mstyle> </math> מודגשים גם הם</p>
<p>שורשי משוואה מודגשת זו <math id="x4" dir="rtl"> <mstyle mathvariant="bold"> <msup> <mi>y</mi> <mn>3</mn> </msup> <mo>+</mo> <mi>p</mi> <mi>y</mi> <mo>+</mo> <mi>q</mi> <mo>=</mo> <mn>0</mn> </mstyle> </math> מודגשים גם הם</p>
</body>
</html>