Skip to content

Commit

Permalink
Add failing test for maps with double quote keys
Browse files Browse the repository at this point in the history
  • Loading branch information
NickColley authored and civan committed Mar 26, 2019
1 parent ef70502 commit 6aded63
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/app/parser/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,38 @@ describe('Parser class', () => {
expect(parsedArray[0].mapValue[1].value).be.equal('$bp-medium');
});

it('should parse map with single quote keys', () => {
let content = `$breakpoints: (
'small': 767px,
'medium': $bp-medium,
'large': 1200px
);`;

let parser = new Parser(content);
let parsedArray = parser.parse();

expect(parsedArray[0].mapValue[0].name).be.equal('small');
expect(parsedArray[0].mapValue[0].value).be.equal('767px');

expect(parsedArray[0].mapValue[1].value).be.equal('$bp-medium');
});

it('should parse map with double quote keys', () => {
let content = `$breakpoints: (
"small": 767px,
"medium": $bp-medium,
"large": 1200px
);`;

let parser = new Parser(content);
let parsedArray = parser.parse();

expect(parsedArray[0].mapValue[0].name).be.equal('small');
expect(parsedArray[0].mapValue[0].value).be.equal('767px');

expect(parsedArray[0].mapValue[1].value).be.equal('$bp-medium');
});

it('should ignore comments inline', () => {
let content = `
$font-size: (
Expand Down

0 comments on commit 6aded63

Please sign in to comment.