Skip to content

Commit

Permalink
fix: quater milimeters not detected (#81)
Browse files Browse the repository at this point in the history
* fix: quater milimeters not detected

* test: added quatermilimeter test and updated snapshots
  • Loading branch information
AndyOGo authored and shellscape committed Mar 26, 2019
1 parent 565e183 commit f3e5522
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
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.

0 comments on commit f3e5522

Please sign in to comment.