mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-10 18:10:44 +09:00
Editor | Fix | Numbered block pattern triggered when not needed due to an incorrect regex pattern (#1987)
This commit is contained in:
parent
2a1fbce079
commit
84ba4ab8fd
3 changed files with 34 additions and 1 deletions
|
@ -6,6 +6,10 @@
|
|||
|
||||
* App | Reminding our users about saving the mnemonic phrase (#1982)
|
||||
|
||||
### Fixes & tech 🚒
|
||||
|
||||
Editor | Fix | Numbered block pattern triggered when not needed due to an incorrect regex pattern (#1987)
|
||||
|
||||
## Version 0.4.4
|
||||
|
||||
### Design & UX 🔳
|
||||
|
|
|
@ -22,4 +22,33 @@ class DefaultPatternMatcherTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should detect numbered pattern`() {
|
||||
|
||||
val strings = listOf("1. ")
|
||||
|
||||
strings.forEach { text ->
|
||||
val result = matcher.match(text)
|
||||
assertEquals(
|
||||
expected = listOf(Pattern.NUMBERED),
|
||||
actual = result
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should not detect numbered pattern`() {
|
||||
|
||||
val strings = listOf("1", "1.", "1 .", "1,", "1, ","1* ","1# ")
|
||||
|
||||
strings.forEach { text ->
|
||||
val result = matcher.match(text)
|
||||
print("matching: $text")
|
||||
assertEquals(
|
||||
expected = emptyList(),
|
||||
actual = result
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ class DefaultPatternMatcher : Matcher<Pattern> {
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val REGEX_NUMBERED_LIST_PATTERN = "^1. "
|
||||
const val REGEX_NUMBERED_LIST_PATTERN = "^1\\. "
|
||||
const val REGEX_DIVIDER_PATTERN = "^---"
|
||||
const val REGEX_CHECKBOX_PATTERN = "^\\[]"
|
||||
const val REGEX_HEADER_ONE_PATERN = "^# "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue