Skip to content

Commit

Permalink
[MM-11287] Add support for plus sign and period/dot in custom URL sch…
Browse files Browse the repository at this point in the history
…emes (mattermost#9155) (mattermost#2842)

* MM-11287 Updates package and unit test after markdown parser update (mattermost#9155)

* MM-11287 Moves test into external links section (mattermost#9155)
  • Loading branch information
letsila authored and hmhealey committed May 27, 2019
1 parent b8e7121 commit 73ebe16
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 39 deletions.
45 changes: 13 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"localforage": "1.7.3",
"localforage-observable": "1.4.0",
"mark.js": "8.11.1",
"marked": "github:mattermost/marked#7041218f9bd64e4bdf9eb2de1b07be57c9050705",
"marked": "github:mattermost/marked#e57e07f419f85178354a3bbbd60de5302483c436",
"mattermost-redux": "github:mattermost/mattermost-redux#a45458bfe2dc4f41c73a4c8d173835de36b58f19",
"moment-timezone": "0.5.23",
"pdfjs-dist": "2.0.489",
Expand Down
18 changes: 12 additions & 6 deletions utils/text_formatting_links.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ describe('Markdown.Links', () => {
'<p>./make-compiled-client.sh</p>'
);

assert.equal(
Markdown.format('test.:test').trim(),
'<p>test.:test</p>'
);

assert.equal(
Markdown.format('`https://example.com`').trim(),
'<p>' +
Expand All @@ -51,6 +46,11 @@ describe('Markdown.Links', () => {
});

it('External links', () => {
assert.equal(
Markdown.format('test.:test').trim(),
'<p><a class="theme markdown__link" href="test.:test" rel="noreferrer" target="_blank">test.:test</a></p>'
);

assert.equal(
Markdown.format('https://example.com').trim(),
'<p><a class="theme markdown__link" href="https://example.com" rel="noreferrer" target="_blank">https://example.com</a></p>'
Expand Down Expand Up @@ -528,7 +528,7 @@ describe('Markdown.Links', () => {

test('only matching links are rendered when schemes are provided', () => {
const options = {
autolinkedUrlSchemes: ['https', 'git', 'test'],
autolinkedUrlSchemes: ['https', 'git', 'test', 'test.', 'taco+what', 'taco.what'],
};

expect(Markdown.format('https://example.com', options).trim()).toBe('<p>https://example.com</p>');
Expand All @@ -544,6 +544,12 @@ describe('Markdown.Links', () => {
expect(Markdown.format('git:https://git.example.com', options).trim()).toBe(`<p>${link('git:https://git.example.com')}</p>`);

expect(Markdown.format('test:test', options).trim()).toBe(`<p>${link('test:test')}</p>`);

expect(Markdown.format('test.:test', options).trim()).toBe(`<p>${link('test.:test')}</p>`);

expect(Markdown.format('taco+what:https://example.com', options).trim()).toBe(`<p>${link('taco+what:https://example.com')}</p>`);

expect(Markdown.format('taco.what:https://example.com', options).trim()).toBe(`<p>${link('taco.what:https://example.com')}</p>`);
});

test('explicit links are not affected by this setting', () => {
Expand Down

0 comments on commit 73ebe16

Please sign in to comment.