Match negatives and float values
This commit is contained in:
parent
8675ce856f
commit
6c57770890
|
@ -14,10 +14,10 @@ GradientParser.parse = (function() {
|
||||||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||||
pixelValue: /^([0-9]+)px/,
|
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
||||||
percentageValue: /^([0-9]+)\%/,
|
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
||||||
emValue: /^([0-9]+)em/,
|
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
||||||
angleValue: /^([0-9]+)deg/,
|
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
||||||
startCall: /^\(/,
|
startCall: /^\(/,
|
||||||
endCall: /^\)/,
|
endCall: /^\)/,
|
||||||
comma: /^,/,
|
comma: /^,/,
|
||||||
|
|
|
@ -14,10 +14,10 @@ GradientParser.parse = (function() {
|
||||||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||||
pixelValue: /^([0-9]+)px/,
|
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
||||||
percentageValue: /^([0-9]+)\%/,
|
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
||||||
emValue: /^([0-9]+)em/,
|
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
||||||
angleValue: /^([0-9]+)deg/,
|
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
||||||
startCall: /^\(/,
|
startCall: /^\(/,
|
||||||
endCall: /^\)/,
|
endCall: /^\)/,
|
||||||
comma: /^,/,
|
comma: /^,/,
|
||||||
|
|
|
@ -14,10 +14,10 @@ GradientParser.parse = (function() {
|
||||||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||||
pixelValue: /^([0-9]+)px/,
|
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
||||||
percentageValue: /^([0-9]+)\%/,
|
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
||||||
emValue: /^([0-9]+)em/,
|
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
||||||
angleValue: /^([0-9]+)deg/,
|
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
||||||
startCall: /^\(/,
|
startCall: /^\(/,
|
||||||
endCall: /^\)/,
|
endCall: /^\)/,
|
||||||
comma: /^,/,
|
comma: /^,/,
|
||||||
|
|
|
@ -197,7 +197,7 @@ describe('gradient-parser.js', function () {
|
||||||
'ellipse cover',
|
'ellipse cover',
|
||||||
'circle cover',
|
'circle cover',
|
||||||
'center bottom, ellipse cover',
|
'center bottom, ellipse cover',
|
||||||
'circle at 119px 58px'
|
'circle at 87.23px -58.3px'
|
||||||
].forEach(function(declaration) {
|
].forEach(function(declaration) {
|
||||||
|
|
||||||
it('should parse ' + declaration + ' declaration', function() {
|
it('should parse ' + declaration + ' declaration', function() {
|
||||||
|
|
Loading…
Reference in a new issue