Match correctly numbers
This commit is contained in:
parent
cb8aa1668e
commit
20f7e8c711
4 changed files with 15 additions and 15 deletions
|
@ -14,10 +14,10 @@ GradientParser.parse = (function() {
|
|||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||
pixelValue: /^([0-9]+)px/,
|
||||
percentageValue: /^([0-9]+)\%/,
|
||||
emValue: /^([0-9]+)em/,
|
||||
angleValue: /^([0-9]+)deg/,
|
||||
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
||||
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
||||
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
||||
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
||||
startCall: /^\(/,
|
||||
endCall: /^\)/,
|
||||
comma: /^,/,
|
||||
|
|
|
@ -14,10 +14,10 @@ GradientParser.parse = (function() {
|
|||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||
pixelValue: /^([0-9]+)px/,
|
||||
percentageValue: /^([0-9]+)\%/,
|
||||
emValue: /^([0-9]+)em/,
|
||||
angleValue: /^([0-9]+)deg/,
|
||||
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
||||
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
||||
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
||||
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
||||
startCall: /^\(/,
|
||||
endCall: /^\)/,
|
||||
comma: /^,/,
|
||||
|
|
|
@ -14,10 +14,10 @@ GradientParser.parse = (function() {
|
|||
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
|
||||
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
|
||||
positionKeywords: /^(left|center|right|top|bottom)/i,
|
||||
pixelValue: /^([0-9]+)px/,
|
||||
percentageValue: /^([0-9]+)\%/,
|
||||
emValue: /^([0-9]+)em/,
|
||||
angleValue: /^([0-9]+)deg/,
|
||||
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
|
||||
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
|
||||
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
|
||||
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
|
||||
startCall: /^\(/,
|
||||
endCall: /^\)/,
|
||||
comma: /^,/,
|
||||
|
|
|
@ -113,7 +113,7 @@ describe('gradient-parser.js', function () {
|
|||
].forEach(function(metric) {
|
||||
describe('parse color stop for metric '+ metric, function() {
|
||||
beforeEach(function() {
|
||||
ast = gradients.parse('linear-gradient(blue 10' + metric + ', transparent)');
|
||||
ast = gradients.parse('linear-gradient(blue 10.3' + metric + ', transparent)');
|
||||
subject = ast[0];
|
||||
});
|
||||
|
||||
|
@ -124,7 +124,7 @@ describe('gradient-parser.js', function () {
|
|||
|
||||
it('should have the length', function() {
|
||||
expect(subject.length.type).to.equal(metric);
|
||||
expect(subject.length.value).to.equal('10');
|
||||
expect(subject.length.value).to.equal('10.3');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -133,7 +133,7 @@ describe('gradient-parser.js', function () {
|
|||
|
||||
describe('parse all linear directional', function() {
|
||||
[
|
||||
{type: 'angular', unparsedValue: '145deg', value: '145'},
|
||||
{type: 'angular', unparsedValue: '-145deg', value: '-145'},
|
||||
{type: 'directional', unparsedValue: 'to left top', value: 'left top'}
|
||||
].forEach(function(orientation) {
|
||||
describe('parse orientation ' + orientation.type, function() {
|
||||
|
|
Loading…
Reference in a new issue