-
Notifications
You must be signed in to change notification settings - Fork 72
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
Showing
4 changed files
with
29 additions
and
18 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,11 @@ const toBeParsedAsHTML: MatcherFunction<[expectedHTML: string]> = function (actu | |
throw new Error('These must be of type number!'); | ||
} | ||
let expected = expectedHTML; | ||
const [, ranges]: [string, Array<[MarkdownType, number, number]>] = (global as any).parseMarkdownToTextAndRanges(actual); | ||
const markdownRanges = ranges.map((range) => { | ||
const ranges = global.parseExpensiMarkToRanges(actual); | ||
const markdownRanges: MarkdownTypes.MarkdownRange[] = ranges.map((range) => { | ||
const [type, startIndex, length] = range; | ||
return { | ||
type, | ||
type: type as MarkdownType, | ||
startIndex, | ||
length, | ||
}; | ||
|
@@ -73,15 +73,15 @@ test('strikethrough', () => { | |
|
||
describe('mention', () => { | ||
test('normal', () => { | ||
expect('@here Hello!').toBeParsedAsHTML('<span class="mention">@here</span> Hello!'); | ||
expect('@here Hello!').toBeParsedAsHTML('<span class="mention-here">@here</span> Hello!'); | ||
}); | ||
|
||
test('with punctation marks', () => { | ||
expect('@here!').toBeParsedAsHTML('<span class="mention">@here</span>!'); | ||
expect('@here!').toBeParsedAsHTML('<span class="mention-here">@here</span>!'); | ||
}); | ||
|
||
test('at the beginning of a heading', () => { | ||
expect('# @here').toBeParsedAsHTML('<span class="syntax"># </span><span class="h1"><span class="mention">@here</span></span>'); | ||
expect('# @here').toBeParsedAsHTML('<span class="syntax"># </span><span class="mention-here"><span class="h1">@here</span></span>'); | ||
}); | ||
}); | ||
|
||
|
@@ -95,7 +95,7 @@ describe('mention-user', () => { | |
}); | ||
|
||
test('at the beginning of a heading', () => { | ||
expect('# @[email protected]').toBeParsedAsHTML('<span class="syntax"># </span><span class="h1"><span class="mention-user">@[email protected]</span></span>'); | ||
expect('# @[email protected]').toBeParsedAsHTML('<span class="syntax"># </span><span class="mention-user"><span class="h1">@[email protected]</span></span>'); | ||
}); | ||
}); | ||
|
||
|
@@ -111,7 +111,9 @@ describe('link', () => { | |
}); | ||
|
||
test('link with same label as href', () => { | ||
expect('[https://example.com](https://example.com)').toBeParsedAsHTML('<span class="link">[https://example.co</span>m](https://example.com)'); | ||
expect('[https://example.com](https://example.com)').toBeParsedAsHTML( | ||
'<span class="syntax">[</span>https://example.com<span class="syntax">](</span><span class="link">https://example.com</span><span class="syntax">)</span>', | ||
); | ||
}); | ||
|
||
test('link with query string', () => { | ||
|
@@ -133,19 +135,27 @@ describe('email', () => { | |
|
||
describe('email with same label as address', () => { | ||
test('label and address without "mailto:"', () => { | ||
expect('[[email protected]]([email protected])').toBeParsedAsHTML('<span class="link">[[email protected]</span>m]([email protected])'); | ||
expect('[[email protected]]([email protected])').toBeParsedAsHTML( | ||
'<span class="syntax">[</span>[email protected]<span class="syntax">](</span><span class="link">[email protected]</span><span class="syntax">)</span>', | ||
); | ||
}); | ||
|
||
test('label with "mailto:"', () => { | ||
expect('[mailto:[email protected]]([email protected])').toBeParsedAsHTML('<span class="link">[mailto:someone@exa</span>mple.com]([email protected])'); | ||
expect('[mailto:[email protected]]([email protected])').toBeParsedAsHTML( | ||
'<span class="syntax">[</span>mailto:[email protected]<span class="syntax">](</span><span class="link">[email protected]</span><span class="syntax">)</span>', | ||
); | ||
}); | ||
|
||
test('address with "mailto:"', () => { | ||
expect('[[email protected]](mailto:[email protected])').toBeParsedAsHTML('<span class="link">[[email protected]</span>m](mailto:[email protected])'); | ||
expect('[[email protected]](mailto:[email protected])').toBeParsedAsHTML( | ||
'<span class="syntax">[</span>[email protected]<span class="syntax">](</span><span class="link">mailto:[email protected]</span><span class="syntax">)</span>', | ||
); | ||
}); | ||
|
||
test('label and address with "mailto:"', () => { | ||
expect('[mailto:[email protected]](mailto:[email protected])').toBeParsedAsHTML('<span class="link">[mailto:someone@exa</span>mple.com](mailto:[email protected])'); | ||
expect('[mailto:[email protected]](mailto:[email protected])').toBeParsedAsHTML( | ||
'<span class="syntax">[</span>mailto:[email protected]<span class="syntax">](</span><span class="link">mailto:[email protected]</span><span class="syntax">)</span>', | ||
); | ||
}); | ||
}); | ||
|
||
|
@@ -154,7 +164,7 @@ test('inline code', () => { | |
}); | ||
|
||
test('codeblock', () => { | ||
expect('```\nHello world!\n```').toBeParsedAsHTML('<span class="syntax">```</span><br><span class="pre">Hello world!\n</span><span class="syntax">```</span>'); | ||
expect('```\nHello world!\n```').toBeParsedAsHTML('<span class="syntax">```</span><span class="pre"><br>Hello world!<br></span><span class="syntax">```</span>'); | ||
}); | ||
|
||
describe('quote', () => { | ||
|
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