Skip to content

fix: correct physical length and resolution conversions - #25

Open
feritcemkahraman wants to merge 1 commit into
ericf:masterfrom
feritcemkahraman:fix/physical-unit-conversions
Open

feritcemkahraman wants to merge 1 commit into
ericf:masterfrom
feritcemkahraman:fix/physical-unit-conversions

Conversation

@feritcemkahraman

Copy link
Copy Markdown

Media queries using points, picas, or dots per centimeter can compare against the wrong breakpoint. For example, (width: 72pt) currently does not match a width of 96px.

Use the CSS unit ratios: 72pt = 6pc = 96px and 100dpcm = 254dpi. Both query expressions and supplied device values go through these conversions. Also correct the existing expectation for 75dpcm exceeding 72dpi.

Fixes #12.

References: https://www.w3.org/TR/css-values-4/#absolute-lengths and https://www.w3.org/TR/css-values-4/#resolution

Validation:

  • Existing baseline: 47 tests pass.
  • Regression tests before the source fix: 46 pass, 4 fail.
  • After the fix: all 50 tests pass with 100% statement, branch, function, and line coverage.
  • Tests check equivalent mixed units in both operands and min/max boundaries.
  • node node_modules/istanbul/lib/cli.js cover -- ./node_modules/mocha/bin/_mocha test/ --reporter dot
  • git diff --check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit multiplier for Point appears to be incorrect...

1 participant