-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eeb06d7
commit fd1c9d1
Showing
13 changed files
with
3,520 additions
and
1,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run test:coverage | ||
npm run test:ci | ||
npx lint-staged |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const inlineStyleParser = require('inline-style-parser'); | ||
const { cases, errors, invalids } = require('./fixtures'); | ||
const parse = require('..'); | ||
|
||
describe('valid cases', () => { | ||
describe.each(cases)('when style=%p', (style, expected) => { | ||
it(`returns \`${JSON.stringify(expected)}\``, () => { | ||
expect(parse(style)).toEqual(expected); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('error cases', () => { | ||
describe.each(errors)('when style=%p', (style) => { | ||
it('throws error', () => { | ||
expect(() => { | ||
parse(style); | ||
}).toThrow(Error); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('invalid cases', () => { | ||
describe.each(invalids)('when style=%p', (style) => { | ||
it('returns null', () => { | ||
expect(parse(style)).toBe(null); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('iterator', () => { | ||
it('returns null', () => { | ||
expect(parse('color: #foo;', () => {})).toBe(null); | ||
}); | ||
|
||
it('invokes callback with arguments=[name, value, declaration]', () => { | ||
const style = 'color: #f00;'; | ||
parse(style, (name, value, declaration) => { | ||
expect(name).toBe('color'); | ||
expect(value).toBe('#f00'); | ||
expect(declaration).toEqual(inlineStyleParser(style)[0]); | ||
}); | ||
}); | ||
|
||
it('parses comment', () => { | ||
const style = '/* color: #f00; */'; | ||
parse(style, (name, value, comment) => { | ||
expect(name).toBe(undefined); | ||
expect(value).toBe(undefined); | ||
expect(comment.comment).toBe(' color: #f00; '); | ||
expect(comment).toEqual(inlineStyleParser(style)[0]); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
collectCoverage: true, | ||
coverageThreshold: { | ||
global: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100 | ||
} | ||
}, | ||
modulePathIgnorePatterns: ['fixtures', 'types'], | ||
testEnvironment: 'node' | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.