Commit 9142641f authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1834388 - Fix dynamic-range WPT tests for the boolean context. r=CanadaHonk

https://drafts.csswg.org/mediaqueries-5/#mq-boolean-context is pretty
clear:

> If the feature would be true for any value other than the number 0, a
> <dimension> with the value 0, the keyword none, or a value explicitly
> defined by that media feature to evaluate as false in a boolean
> context, the media feature evaluates to true.
> Otherwise, it evaluates to false.

These hit the "otherwise". The unknown behavior might make sense, but if
someone wants it the spec needs to change (for all media features
consistently).

Differential Revision: https://phabricator.services.mozilla.com/D178712
parent 43c710b2
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
[dynamic-range.html]
  [Should be unknown: '(dynamic-range)']
    expected: FAIL

  [Should be unknown: '(video-dynamic-range)']
    expected: FAIL
+13 −2
Original line number Diff line number Diff line
@@ -10,15 +10,26 @@ query_should_be_known("(dynamic-range: high)");
query_should_be_known("(video-dynamic-range: standard)");
query_should_be_known("(video-dynamic-range: high)");

query_should_be_unknown("(dynamic-range)");
query_should_be_known("(dynamic-range)");
query_should_be_known("(video-dynamic-range)");

query_should_be_unknown("(dynamic-range: 0)");
query_should_be_unknown("(dynamic-range: 10px)");
query_should_be_unknown("(dynamic-range: invalid)");
query_should_be_unknown("(video-dynamic-range)");
query_should_be_unknown("(video-dynamic-range: 0)");
query_should_be_unknown("(video-dynamic-range: 10px)");
query_should_be_unknown("(video-dynamic-range: invalid)");

test(() => {
  let match_boolean = window.matchMedia("(dynamic-range)");
  assert_false(match_boolean.matches);
}, "Check that dynamic-range evaluates to false in the boolean context");

test(() => {
  let match_boolean = window.matchMedia("(video-dynamic-range)");
  assert_false(match_boolean.matches);
}, "Check that video-dynamic-range evaluates to false in the boolean context");

test(() => {
  let match_standard = window.matchMedia("(dynamic-range: standard)");
  assert_true(match_standard.matches);