Skip to content
Permalink
Browse files

fix: underline(_) is not allowed inside words(fix #409)

  • Loading branch information...
sohee-lee7 committed Mar 12, 2019
1 parent 12ab35f commit 00b75faec43f278d84abb153f871afbb9a1c6bab
@@ -87,7 +87,7 @@ const Italic = CommandManager.command('markdown', /** @lends Italic */{
* @returns {string} - italic text
*/
append(text) {
return `_${text}_`;
return `*${text}*`;
},

/**
@@ -10,7 +10,7 @@ test('click italic button then type text', async t => {
.pressKey('e')
.pressKey('s')
.pressKey('t')
.expect(editor.markdown.lines.nth(0).textContent).eql('_test_')
.expect(editor.markdown.lines.nth(0).textContent).eql('*test*')
.expect(editor.markdown.preview.innerHTML).contains('<em>');
});

@@ -24,6 +24,6 @@ test('type text, select the text then click italic button', async t => {
.pressKey('home')
.pressKey('shift+end')
.click(editor.toolbar.italic)
.expect(editor.markdown.lines.nth(0).textContent).eql('_test_')
.expect(editor.markdown.lines.nth(0).textContent).eql('*test*')
.expect(editor.markdown.preview.innerHTML).contains('<em>');
});
@@ -36,15 +36,15 @@ describe('Italic', () => {

Italic.exec(mde);

expect(cm.getValue()).toEqual(['mytext1', '', 'myt__ext2', 'mytext3'].join('\n'));
expect(cm.getValue()).toEqual(['mytext1', '', 'myt**ext2', 'mytext3'].join('\n'));
});

it('in a blank line', () => {
doc.setCursor(1, 3);

Italic.exec(mde);

expect(cm.getValue()).toEqual(['mytext1', '__', 'mytext2', 'mytext3'].join('\n'));
expect(cm.getValue()).toEqual(['mytext1', '**', 'mytext2', 'mytext3'].join('\n'));
});

it('around selected text', () => {
@@ -58,7 +58,7 @@ describe('Italic', () => {

Italic.exec(mde);

expect(cm.getValue()).toEqual(['_mytext1_', '', 'mytext2', 'mytext3'].join('\n'));
expect(cm.getValue()).toEqual(['*mytext1*', '', 'mytext2', 'mytext3'].join('\n'));
});

it('should remove italic syntax in the middle of the given range', () => {
@@ -74,7 +74,7 @@ describe('Italic', () => {

Italic.exec(mde);

expect(cm.getValue()).toEqual('_my text 1_');
expect(cm.getValue()).toEqual('*my text 1*');
});
});
});

0 comments on commit 00b75fa

Please sign in to comment.
You can’t perform that action at this time.