merror-001.html (1645B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test the merror element</title> 6 <link rel="help" href="https://w3c.github.io/mathml-core/#error-message-merror"> 7 <link rel="help" href="https://w3c.github.io/mathml-core/#user-agent-stylesheet"> 8 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 9 <meta name="assert" content="Verify default merror style and size."> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <style> 13 math { 14 font: 25px/1 Ahem; 15 } 16 </style> 17 </head> 18 <body> 19 <div id="log"></div> 20 <div> 21 <math> 22 <mrow id="reference"><mtext>AN ERROR</mtext></mrow> 23 <merror id="merror"><mtext>AN ERROR</mtext></merror> 24 </math> 25 </div> 26 <script> 27 setup({ explicit_done: true }); 28 document.fonts.ready.then(() => { 29 test(function () { 30 var style = window.getComputedStyle(document.getElementById("merror")); 31 assert_equals(style.borderWidth, "1px"); 32 assert_equals(style.borderColor, "rgb(255, 0, 0)"); 33 assert_equals(style.borderStyle, "solid"); 34 assert_equals(style.backgroundColor, "rgb(255, 255, 224)"); 35 }, "Default CSS properties on merror"); 36 37 test(function () { 38 var merrorBox = document.getElementById("merror").getBoundingClientRect(); 39 var referenceBox = document.getElementById("reference").getBoundingClientRect(); 40 assert_equals(merrorBox.width, referenceBox.width + 2); 41 assert_equals(merrorBox.height, referenceBox.height + 2); 42 }, "Bounding box is the same as mrow + 1px border"); 43 44 done(); 45 }); 46 </script> 47 </body> 48 </html>