-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docz-utils): fix closing tag detection in
removeTags
(#1696)
- Loading branch information
1 parent
f836dcd
commit bfcd923
Showing
6 changed files
with
238 additions
and
15 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,14 @@ | ||
{ | ||
"plugins": ["lodash"], | ||
"presets": [ | ||
"@babel/preset-typescript", | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
] | ||
} |
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,35 @@ | ||
import { removeTags } from '../src/jsx' | ||
|
||
describe('removeTags', () => { | ||
test('removes outer JSX tag', () => { | ||
expect( | ||
removeTags(` | ||
<Playground> | ||
<div>Some text</div> | ||
<p>Other text</p> | ||
</Playground> | ||
`) | ||
).toMatchInlineSnapshot(` | ||
" | ||
<div>Some text</div> | ||
<p>Other text</p> | ||
" | ||
`) | ||
}) | ||
|
||
test('works when the closing tag is repeated in a comment', () => { | ||
expect( | ||
removeTags(` | ||
<Playground> | ||
{/* </Playground> */} | ||
<div>Some text</div> | ||
</Playground> | ||
`) | ||
).toMatchInlineSnapshot(` | ||
" | ||
{/* </Playground> */} | ||
<div>Some text</div> | ||
" | ||
`) | ||
}) | ||
}) |
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
Oops, something went wrong.