Skip to content

Commit 9424eed

Browse files
authored
Merge pull request #1041 from TheSky599/MicAnchorBlockTest
Test for MicAnchorBlock
2 parents f6ec3f6 + eb001f3 commit 9424eed

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/Microdown-Tests/MicAnchorBlockTest.class.st

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,40 @@ MicAnchorBlockTest >> subjectClass [
1111
^ MicAnchorBlock
1212
]
1313

14+
{ #category : 'tests' }
15+
MicAnchorBlockTest >> testAnchorAndText [
16+
| doc |
17+
doc := Microdown parse: '@ancre
18+
Ceci est un paragraphe'.
19+
self assert: doc children size equals: 2.
20+
self assert: doc children first class name equals: #MicAnchorBlock.
21+
self assert: doc children second class name equals: #MicParagraphBlock
22+
]
23+
24+
{ #category : 'tests' }
25+
MicAnchorBlockTest >> testAnchorName [
26+
| doc anchor |
27+
doc := Microdown parse: '@myAnchor'.
28+
anchor := doc children first.
29+
self assert: anchor class name equals: #MicAnchorBlock.
30+
self assert: anchor label equals: 'myAnchor'
31+
]
32+
33+
{ #category : 'tests' }
34+
MicAnchorBlockTest >> testAnchorWithDashesAndUnderscores [
35+
| doc anchor |
36+
doc := Microdown parse: '@my-anchor_01'.
37+
anchor := doc children first.
38+
self assert: anchor label equals: 'my-anchor_01'
39+
]
40+
41+
{ #category : 'tests' }
42+
MicAnchorBlockTest >> testInvalidAnchor [
43+
| doc |
44+
doc := Microdown parse: '@'.
45+
self assert: doc children first class name equals: #MicAnchorBlock
46+
]
47+
1448
{ #category : 'tests' }
1549
MicAnchorBlockTest >> testModifyLabel [
1650
| mic |
@@ -19,3 +53,13 @@ MicAnchorBlockTest >> testModifyLabel [
1953
mic label: 'label2'.
2054
self assert: mic label equals: 'label2'.
2155
]
56+
57+
{ #category : 'tests' }
58+
MicAnchorBlockTest >> testMultipleAnchors [
59+
| doc |
60+
doc := Microdown parse: '@ancre1
61+
@ancre2'.
62+
self assert: doc children size equals: 2.
63+
self assert: doc children first label equals: 'ancre1'.
64+
self assert: doc children second label equals: 'ancre2'
65+
]

0 commit comments

Comments
 (0)