Attachment #8847506: css-color computed style test. for bug #1347164

View | Details | Raw Unified | Return to bug 1347164
Collapse All | Expand All

(-)a/layout/style/test/test_computed_style.html (+30 lines)
Line     Link Here 
 Lines 370-381   var noframe_container = document.getElementById("content"); Link Here 
370
    is(cs[prop], localURL + testStyles[prop], "computed value of " + prop);
370
    is(cs[prop], localURL + testStyles[prop], "computed value of " + prop);
371
    p.style[prop] = nonLocalURL;
371
    p.style[prop] = nonLocalURL;
372
    is(cs[prop], resolvedNonLocalURL + testStyles[prop], "computed value of " + prop);
372
    is(cs[prop], resolvedNonLocalURL + testStyles[prop], "computed value of " + prop);
373
  }
373
  }
374
374
375
  p.remove();
375
  p.remove();
376
})();
376
})();
377
377
378
(function test_bug_1347164() {
379
  var color = [
380
    ["rgba(0, 0, 0, 1)", "rgb(0, 0, 0)"],
381
    ["rgba(0, 0, 0, 0.5)", "rgba(0, 0, 0, 0.5)"],
382
    ["hsla(0, 0%, 0%, 1)", "rgb(0, 0, 0)"],
383
    ["hsla(0, 0%, 0%, 0.5)", "rgba(0, 0, 0, 0.5)"],
384
    // css-color-4
385
    ["rgba(0 0 0 / 1)", "rgb(0, 0, 0)"],
386
    ["rgba(0 0 0 / 0.5)", "rgba(0, 0, 0, 0.5)"],
387
    ["rgb(0 0 0 / 1)", "rgb(0, 0, 0)"],
388
    ["rgb(0 0 0 / 0.5)", "rgba(0, 0, 0, 0.5)"],
389
    ["hsla(0 0% 0% / 1)", "rgb(0, 0, 0)"],
390
    ["hsla(0deg 0% 0% / 0.5)", "rgba(0, 0, 0, 0.5)"],
391
    ["hsl(0 0% 0% / 1)", "rgb(0, 0, 0)"],
392
    ["hsl(0 0% 0% / 0.5)", "rgba(0, 0, 0, 0.5)"],
393
  ];
394
395
  var p = document.createElement("p");
396
  var cs = getComputedStyle(p, "");
397
  frame_container.appendChild(p);
398
399
  for (var i = 0; i < color.length; ++i) {
400
    var test = color[i];
401
    p.style.color = test[0];
402
    is(cs.color, test[1], "computed value of " + test[0]);
403
  }
404
405
  p.remove();
406
})();
407
378
</script>
408
</script>
379
</pre>
409
</pre>
380
</body>
410
</body>
381
</html>
411
</html>

Return to bug 1347164