Skip to content

Commit

Permalink
Convert resize when it is specified using a plus operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjeffburke committed Feb 4, 2020
1 parent ff61fdc commit 46e49a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/prepareImproQueryString.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ module.exports = function prepareQueryString(queryString) {
optionToResize = arg;
} else {
let fragment = pair;
if (op === 'resize' && arg.indexOf(',') === -1) {
// single value form of resize
fragment += ',';
if (op === 'resize') {
if (arg.indexOf('+') > -1) {
// specified using a plus operator
fragment = fragment.replace('+', ',');
} else if (arg.indexOf(',') === -1) {
// single value form of resize
fragment += ',';
}
}
queryStringFragments.push(fragment);
}
Expand Down
8 changes: 8 additions & 0 deletions test/prepareImproQueryString.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ expect.addAssertion('<string> when prepared <assertion>', (expect, subject) => {
});

describe('prepareImproQueryString', () => {
it('should parse resize (comma separator)', () => {
expect('resize=800,800', 'when prepared to equal', 'resize=800,800');
});

it('should parse resize (plus separator)', () => {
expect('resize=800+800', 'when prepared to equal', 'resize=800,800');
});

it('should parse svgfilter with options', () => {
expect(
'svgfilter=--runScript=addBogusElement.js,--bogusElementId=theBogusElementId',
Expand Down

0 comments on commit 46e49a1

Please sign in to comment.