File tree Expand file tree Collapse file tree 3 files changed +63
-0
lines changed
openformats/tests/formats/markdown_jsx Expand file tree Collapse file tree 3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Alert , Button } from ' ./components'
2
+
3
+ # Welcome to My MDX Page 🎉
4
+
5
+ This is a regular Markdown heading. Below is a list:
6
+
7
+ - Works with ** Markdown**
8
+ - Supports _ emphasis_ , ** bold** , and ` inline code `
9
+ - Lets you embed components 👇
10
+
11
+ ---
12
+
13
+ ## 🚀 Interactive Component
14
+
15
+ <Alert type = " success" >
16
+ ✅ Success! You can render React components inside Markdown.
17
+ </Alert >
18
+
19
+ ---
20
+
21
+ ## 📦 Props in Components
22
+
23
+ You can pass props like this:
24
+
25
+ <Button onClick = { () => alert (' You clicked the button!' )} >
26
+ Click Me
27
+ </Button >
28
+
29
+ ---
30
+
31
+ ## 📜 Code Block
32
+
33
+ ``` js
34
+ console .log (' MDX supports code highlighting too!' );
Original file line number Diff line number Diff line change
1
+ import unittest
2
+ from io import open
3
+ from os import path
4
+
5
+ from openformats .formats .markdown_jsx import MarkdownJsxHandler
6
+ from openformats .tests .formats .common import CommonFormatTestMixin
7
+
8
+
9
+ class MarkdownJsxTestCase (CommonFormatTestMixin , unittest .TestCase ):
10
+ """Tests the basic functionality of MarkdownJsxHandler."""
11
+ HANDLER_CLASS = MarkdownJsxHandler
12
+ TESTFILE_BASE = "openformats/tests/formats/markdown_jsx/files"
13
+
14
+ def __init__ (self , * args , ** kwargs ):
15
+ super (MarkdownJsxTestCase , self ).__init__ (* args , ** kwargs )
16
+ filepath = path .join (self .TESTFILE_BASE , "test.mdx" )
17
+ with open (filepath , "r" , encoding = 'utf-8' ) as myfile :
18
+ self .data ['test' ] = myfile .read ()
19
+
20
+ def test_compile (self ):
21
+ """Test that import-export is the same as the original file."""
22
+ remade_orig_content = self .handler .compile (self .tmpl , self .strset )
23
+ self .assertEqual (remade_orig_content , self .data ["test" ])
24
+
25
+ def test_parse (self ):
26
+ """Test parse converts tabs to spaces"""
27
+ content_with_tab = self .handler .parse (content = u"# foo bar" )
28
+ content_with_spaces = self .handler .parse (content = u"# foo bar" )
29
+ self .assertEqual (content_with_tab [0 ], content_with_spaces [0 ])
You can’t perform that action at this time.
0 commit comments