mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 10:57:34 +09:00
Issue #1826 - Support calc() in media queries
This commit is contained in:
parent
19e946c77e
commit
adde59de74
3 changed files with 14 additions and 5 deletions
|
|
@ -237,6 +237,7 @@ function run() {
|
|||
expression_should_be_parseable(feature + ": 0");
|
||||
expression_should_be_parseable(feature + ": 0px");
|
||||
expression_should_be_parseable(feature + ": 0em");
|
||||
expression_should_be_parseable(feature + ": calc(0px + 0em)");
|
||||
expression_should_be_parseable(feature + ": -0");
|
||||
expression_should_be_parseable("min-" + feature + ": -0");
|
||||
expression_should_be_parseable("max-" + feature + ": -0");
|
||||
|
|
@ -244,6 +245,7 @@ function run() {
|
|||
expression_should_be_parseable(feature + ": 1px");
|
||||
expression_should_be_parseable(feature + ": 0.001mm");
|
||||
expression_should_be_parseable(feature + ": 100000px");
|
||||
expression_should_not_be_parseable(feature + ": calc(1px + 1%)");
|
||||
expression_should_not_be_parseable(feature + ": -1px");
|
||||
expression_should_not_be_parseable("min-" + feature + ": -1px");
|
||||
expression_should_not_be_parseable("max-" + feature + ": -1px");
|
||||
|
|
@ -263,8 +265,9 @@ function run() {
|
|||
|
||||
var content_div = document.getElementById("content");
|
||||
content_div.style.font = "initial";
|
||||
var em_size =
|
||||
getComputedStyle(content_div, "").fontSize.match(/^(\d+)px$/)[1];
|
||||
var em_size = parseFloat(
|
||||
getComputedStyle(content_div, "").fontSize.match(/^(\d+)px$/)[1]
|
||||
);
|
||||
|
||||
// in this test, assume the common underlying implementation is correct
|
||||
var width_val = 117; // pick two not-too-round numbers
|
||||
|
|
@ -282,7 +285,11 @@ function run() {
|
|||
for (feature in features) {
|
||||
var value = features[feature];
|
||||
should_apply("all and (" + feature + ": " + value + "px)");
|
||||
should_apply("all and (" + feature + ": calc(" +
|
||||
(value - em_size) + "px + 1em))");
|
||||
should_not_apply("all and (" + feature + ": " + (value + 1) + "px)");
|
||||
should_not_apply("all and (" + feature + ": calc(" +
|
||||
(value - em_size + 1) + "px + 1em))");
|
||||
should_not_apply("all and (" + feature + ": " + (value - 1) + "px)");
|
||||
should_apply("all and (min-" + feature + ": " + value + "px)");
|
||||
should_not_apply("all and (min-" + feature + ": " + (value + 1) + "px)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue