-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mobile: Fixes #9477: Fix inline code at beginning of line in table br…
…eaks formatting (#9478)
- Loading branch information
1 parent
1bbec44
commit 815a0a5
Showing
5 changed files
with
54 additions
and
7 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
30 changes: 30 additions & 0 deletions
30
packages/editor/CodeMirror/markdown/decoratorExtension.test.ts
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,30 @@ | ||
import { EditorSelection } from '@codemirror/state'; | ||
import createTestEditor from '../testUtil/createTestEditor'; | ||
import decoratorExtension from './decoratorExtension'; | ||
|
||
jest.retryTimes(2); | ||
|
||
describe('decoratorExtension', () => { | ||
it('should highlight code blocks within tables', async () => { | ||
// Regression test for https://github.com/laurent22/joplin/issues/9477 | ||
const editorText = ` | ||
left | right | ||
--------|------- | ||
\`foo\` | bar | ||
`; | ||
const editor = await createTestEditor( | ||
editorText, | ||
|
||
// Put the initial cursor at the start of "foo" | ||
EditorSelection.cursor(editorText.indexOf('foo')), | ||
|
||
['TableRow', 'InlineCode'], | ||
[decoratorExtension], | ||
); | ||
|
||
const codeBlock = editor.contentDOM.querySelector('.cm-inlineCode'); | ||
|
||
expect(codeBlock.textContent).toBe('`foo`'); | ||
expect(codeBlock.parentElement.classList.contains('.cm-tableRow')); | ||
}); | ||
}); |
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