-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds FootnoteModifier and ClickableModifier
- Loading branch information
Showing
12 changed files
with
299 additions
and
77 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
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
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
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
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
markdown-ui/src/test/kotlin/land/sungbin/markdown/ui/modifier/ClickableTransformerTest.kt
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 @@ | ||
/* | ||
* Developed by Ji Sungbin 2024. | ||
* | ||
* Licensed under the MIT. | ||
* Please see full license: https://github.com/jisungbin/compose-markdown/blob/main/LICENSE | ||
*/ | ||
|
||
package land.sungbin.markdown.ui.modifier | ||
|
||
import assertk.assertThat | ||
import assertk.assertions.isEqualTo | ||
import kotlin.test.Test | ||
import land.sungbin.markdown.ui.transform | ||
|
||
class ClickableTransformerTest { | ||
@Test fun clickableRangeStartsWithZero() { | ||
val result = ClickableTransformer(link = "bye", range = { 0..4 }).transform("hello, world!") | ||
assertThat(result).isEqualTo("[hello](bye), world!") | ||
} | ||
|
||
@Test fun clickableRangeInMiddle() { | ||
val result = ClickableTransformer(link = "bye", range = { 5..6 }).transform("hello, world!") | ||
assertThat(result).isEqualTo("hello[, ](bye)world!") | ||
} | ||
|
||
@Test fun clickableRangeEndsWithLastIndex() { | ||
val result = ClickableTransformer(link = "bye", range = { 7..12 }).transform("hello, world!") | ||
assertThat(result).isEqualTo("hello, [world!](bye)") | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
markdown-ui/src/test/kotlin/land/sungbin/markdown/ui/modifier/FootnoteTransformerTest.kt
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 @@ | ||
/* | ||
* Developed by Ji Sungbin 2024. | ||
* | ||
* Licensed under the MIT. | ||
* Please see full license: https://github.com/jisungbin/compose-markdown/blob/main/LICENSE | ||
*/ | ||
|
||
package land.sungbin.markdown.ui.modifier | ||
|
||
import assertk.assertThat | ||
import assertk.assertions.isEqualTo | ||
import kotlin.test.Test | ||
import land.sungbin.markdown.ui.transform | ||
|
||
class FootnoteTransformerTest { | ||
@Test fun footnotePositionStartsWithZero() { | ||
val result = FootnoteModifier(tag = "bye", position = { 0 }).transform("hello, world!") | ||
assertThat(result).isEqualTo("[^bye]hello, world!") | ||
} | ||
|
||
@Test fun footnotePositionInMiddle() { | ||
val result = FootnoteModifier(tag = "bye", position = { 5 }).transform("hello, world!") | ||
assertThat(result).isEqualTo("hello,[^bye] world!") | ||
} | ||
|
||
@Test fun footnotePositionEndsWithLastIndex() { | ||
val result = FootnoteModifier(tag = "bye", position = { 12 }).transform("hello, world!") | ||
assertThat(result).isEqualTo("hello, world![^bye]") | ||
} | ||
} |
Oops, something went wrong.