-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement useLinkRef config and add unit tests
- Loading branch information
1 parent
ba56ce9
commit 7b3860b
Showing
6 changed files
with
89 additions
and
2 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
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,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Link Reference should not use the link references for link construction when disabled from config 1`] = ` | ||
"<p><a href=\\"https://www.somewebsite.com\\">I'm an inline-style link</a></p> | ||
<p><a href=\\"https://www.somewebsite.com\\" title=\\"somewebsite's Homepage\\">I'm an inline-style link with title</a></p> | ||
<p>[I'm a reference-style link][Arbitrary case-insensitive reference text]</p> | ||
<p><a href=\\"../blob/master/LICENSE\\">I'm a relative reference to a repository file</a></p> | ||
<p><a href=\\"http://somewebsite.org\\" title=\\"somewebsite\\">You can use numbers for reference-style link definitions</a></p> | ||
<p>Or leave it empty and use the <a href=\\"http://www.somewebsite.com\\">link text itself</a></p> | ||
<p>Some text to show that the reference links can follow later.</p> | ||
" | ||
`; | ||
exports[`Link Reference should use the link references for link construction 1`] = ` | ||
"<p><a href=\\"https://www.somewebsite.com\\">I'm an inline-style link</a></p> | ||
<p><a href=\\"https://www.somewebsite.com\\" title=\\"somewebsite's Homepage\\">I'm an inline-style link with title</a></p> | ||
<p>[I'm a reference-style link][Arbitrary case-insensitive reference text]</p> | ||
<p><a href=\\"../blob/master/LICENSE\\">I'm a relative reference to a repository file</a></p> | ||
<p><a href=\\"http://somewebsite.org\\" title=\\"somewebsite\\">You can use numbers for reference-style link definitions</a></p> | ||
<p>Or leave it empty and use the <a href=\\"http://www.somewebsite.com\\">link text itself</a></p> | ||
<p>Some text to show that the reference links can follow later.</p> | ||
" | ||
`; |
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 HtmlMark from "../../../lib/index.js" | ||
|
||
|
||
describe("Link Reference", () => { | ||
const htmlMarkWithLinkRefsOn = new HtmlMark() | ||
const htmlMarkWithLinkRefsOff = new HtmlMark({ useLinkRefs: false }) | ||
|
||
const lines = `[I'm an inline-style link](https://www.somewebsite.com) | ||
[I'm an inline-style link with title](https://www.somewebsite.com "somewebsite's Homepage") | ||
[I'm a reference-style link][Arbitrary case-insensitive reference text] | ||
[I'm a relative reference to a repository file](../blob/master/LICENSE) | ||
[You can use numbers for reference-style link definitions][1] | ||
Or leave it empty and use the [link text itself] | ||
Some text to show that the reference links can follow later. | ||
[arbitrary case-insensitive reference text]: https://www.somewebsite.org | ||
[1]: http://somewebsite.org "somewebsite's Homepage" | ||
[link text itself]: http://www.somewebsite.com` | ||
|
||
it("should use the link references for link construction", () => { | ||
const html = htmlMarkWithLinkRefsOn.parse(lines) | ||
expect(html).toMatchSnapshot() | ||
}) | ||
|
||
it("should not use the link references for link construction when disabled from config", () => { | ||
const html = htmlMarkWithLinkRefsOff.parse(lines) | ||
expect(html).toMatchSnapshot() | ||
}) | ||
}) |