-
-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from smooth-code/refactor-emSize
Various improvements
- Loading branch information
Showing
9 changed files
with
783 additions
and
380 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CHANGELOG.md |
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
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,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`emSize should add width & height if not present 1`] = ` | ||
"<svg width=\\"1em\\" height=\\"1em\\"> | ||
<g stroke=\\"#063855\\" strokeWidth={2} /> | ||
</svg> | ||
" | ||
`; | ||
|
||
exports[`emSize should keep other attributes 1`] = ` | ||
"<svg viewBox=\\"0 0 10 10\\" width=\\"1em\\" height=\\"1em\\"> | ||
<g stroke=\\"#063855\\" strokeWidth={2} /> | ||
</svg> | ||
" | ||
`; | ||
|
||
exports[`emSize should replace width and height value by 1em 1`] = ` | ||
"<svg width=\\"1em\\" height=\\"1em\\"> | ||
<g stroke=\\"#063855\\" strokeWidth={2} /> | ||
</svg> | ||
" | ||
`; |
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,38 @@ | ||
import jsx from 'h2x-plugin-jsx' | ||
import h2x from '../plugins/h2x' | ||
import emSize from './emSize' | ||
|
||
describe('emSize', () => { | ||
it('should add width & height if not present', () => { | ||
const result = h2x( | ||
`<svg> | ||
<g stroke="#063855" stroke-width="2" /> | ||
</svg>`, | ||
{ plugins: [jsx, emSize] }, | ||
) | ||
|
||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
it('should replace width and height value by 1em', () => { | ||
const result = h2x( | ||
`<svg width="10px" height="10px"> | ||
<g stroke="#063855" stroke-width="2" /> | ||
</svg>`, | ||
{ plugins: [jsx, emSize] }, | ||
) | ||
|
||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
it('should keep other attributes', () => { | ||
const result = h2x( | ||
`<svg viewbox="0 0 10 10" width="10px" height="10px"> | ||
<g stroke="#063855" stroke-width="2" /> | ||
</svg>`, | ||
{ plugins: [jsx, emSize] }, | ||
) | ||
|
||
expect(result).toMatchSnapshot() | ||
}) | ||
}) |
Oops, something went wrong.