Merge pull request #15 from itaigilo-inv/support-more-directions

Support more directions
This commit is contained in:
Rafael Caricio 2021-07-21 15:34:54 +02:00 committed by GitHub
commit 92b6e8011e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -11,7 +11,7 @@ GradientParser.parse = (function() {
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|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]*\.[0-9]+)|([0-9]+\.?)))px/,

View file

@ -134,7 +134,11 @@ describe('lib/parser.js', function () {
describe('parse all linear directional', function() {
[
{type: 'angular', unparsedValue: '-145deg', value: '-145'},
{type: 'directional', unparsedValue: 'to left top', value: 'left top'}
{type: 'directional', unparsedValue: 'to left top', value: 'left top'},
{type: 'directional', unparsedValue: 'to top left', value: 'top left'},
{type: 'directional', unparsedValue: 'to top right', value: 'top right'},
{type: 'directional', unparsedValue: 'to bottom left', value: 'bottom left'},
{type: 'directional', unparsedValue: 'to bottom right', value: 'bottom right'}
].forEach(function(orientation) {
describe('parse orientation ' + orientation.type, function() {
beforeEach(function() {