Skip to content

fix: quater milimeters not detected #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/nodes/Numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { registerWalker } = require('../walker');

const Node = require('./Node');

const unitRegex = /%|ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmax|vmin|vw$/i;
const unitRegex = /%|ch|cm|em|ex|in|mm|pc|pt|px|q|rem|vh|vmax|vmin|vw$/i;

class Numeric extends Node {
constructor(options = {}) {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
'-2px',
'-16px',
'-16px -1px -1px -16px',
'10q',
'1e10',
'1E10',
'1e-10',
Expand Down
57 changes: 48 additions & 9 deletions test/snapshots/numeric.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '-.567800E-0012780em',
hasBOM: false,
id: '<input css 19>',
id: '<input css 20>',
},
start: {
column: 1,
Expand Down Expand Up @@ -375,7 +375,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '.1E+10',
hasBOM: false,
id: '<input css 21>',
id: '<input css 22>',
},
start: {
column: 1,
Expand Down Expand Up @@ -414,7 +414,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '.1E-10',
hasBOM: false,
id: '<input css 20>',
id: '<input css 21>',
},
start: {
column: 1,
Expand Down Expand Up @@ -505,6 +505,45 @@ Generated by [AVA](https://ava.li).
},
]

## 10q

> Snapshot 1

'10q'

> Snapshot 2

'10q'

> Snapshot 3

[
Numeric {
raws: {
after: '',
before: '',
},
source: {
end: {
column: 1,
line: 1,
},
input: Input {
css: '10q',
hasBOM: false,
id: '<input css 13>',
},
start: {
column: 1,
line: 1,
},
},
type: 'numeric',
unit: 'q',
value: '10',
},
]

## 1E+10

> Snapshot 1
Expand All @@ -531,7 +570,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '1E+10',
hasBOM: false,
id: '<input css 18>',
id: '<input css 19>',
},
start: {
column: 1,
Expand Down Expand Up @@ -570,7 +609,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '1E-10',
hasBOM: false,
id: '<input css 16>',
id: '<input css 17>',
},
start: {
column: 1,
Expand Down Expand Up @@ -609,7 +648,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '1E10',
hasBOM: false,
id: '<input css 14>',
id: '<input css 15>',
},
start: {
column: 1,
Expand Down Expand Up @@ -648,7 +687,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '1e+10',
hasBOM: false,
id: '<input css 17>',
id: '<input css 18>',
},
start: {
column: 1,
Expand Down Expand Up @@ -687,7 +726,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '1e-10',
hasBOM: false,
id: '<input css 15>',
id: '<input css 16>',
},
start: {
column: 1,
Expand Down Expand Up @@ -726,7 +765,7 @@ Generated by [AVA](https://ava.li).
input: Input {
css: '1e10',
hasBOM: false,
id: '<input css 13>',
id: '<input css 14>',
},
start: {
column: 1,
Expand Down
Binary file modified test/snapshots/numeric.test.js.snap
Binary file not shown.