layout/style/test/test_bug437915.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/test/test_bug437915.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=437915
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 437915</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +  <style type="text/css">
    1.14 +
    1.15 +  div.classvalue { text-decoration: underline; }
    1.16 +  div[title~="titlevalue"] { visibility: hidden; }
    1.17 +
    1.18 +  </style>
    1.19 +</head>
    1.20 +<body>
    1.21 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437915">Mozilla Bug 437915</a>
    1.22 +<p id="display"></p>
    1.23 +<div id="content" style="display: none">
    1.24 +  
    1.25 +</div>
    1.26 +<pre id="test">
    1.27 +<script class="testbody" type="text/javascript">
    1.28 +
    1.29 +/** Test for Bug 437915 **/
    1.30 +
    1.31 +var div = document.getElementById("content");
    1.32 +var cs = document.defaultView.getComputedStyle(div, "");
    1.33 +
    1.34 +var chars = {
    1.35 +  0x09: true, // tab
    1.36 +  0x0a: true, // newline
    1.37 +  0x0b: false, // vertical tab (MAY CHANGE IN FUTURE!)
    1.38 +  0x0c: true, // form feed
    1.39 +  0x0d: true, // carriage return
    1.40 +  0x0e: false,
    1.41 +  0x20: true, // space
    1.42 +  0x2003: false,
    1.43 +  0x200b: false,
    1.44 +  0x2028: false,
    1.45 +  0x2029: false,
    1.46 +  0x3000: false
    1.47 +};
    1.48 +
    1.49 +var wsmap = {
    1.50 +  false: { str: " NOT", "text-decoration": "none", "visibility": "visible" },
    1.51 +  true: { str: "", "text-decoration": "underline", "visibility": "hidden" }
    1.52 +};
    1.53 +
    1.54 +for (var char in chars) {
    1.55 +  var is_whitespace = chars[char];
    1.56 +  var mapent = wsmap[is_whitespace];
    1.57 +  div.setAttribute("class", "classvalue" + String.fromCharCode(char) + "b")
    1.58 +  div.setAttribute("title", "a" + String.fromCharCode(char) + "titlevalue")
    1.59 +  for (var prop of ["text-decoration", "visibility"]) {
    1.60 +    is(cs.getPropertyValue(prop), mapent[prop],
    1.61 +       "Character " + char + " should" + mapent.str +
    1.62 +       " be treated as whitespace ("
    1.63 +       + prop + " should be " + mapent[prop] + ")");
    1.64 +  }
    1.65 +}
    1.66 +
    1.67 +
    1.68 +
    1.69 +</script>
    1.70 +</pre>
    1.71 +</body>
    1.72 +</html>
    1.73 +

mercurial