disable undo-like functionality for textInput, fixes #1019

This commit is contained in:
Helium314 2025-02-03 00:20:48 +01:00
parent 73988394a9
commit f2a46cfa9a
2 changed files with 35 additions and 1 deletions

View file

@ -613,6 +613,35 @@ class InputLogicTest {
assertEquals("{\"label\": \"c", text)
}
@Test fun `text input and delete`() {
reset()
input("hello")
assertEquals("hello", text)
functionalKeyPress(KeyCode.DELETE)
assertEquals("hell", text)
reset()
input("hello ")
assertEquals("hello ", text)
functionalKeyPress(KeyCode.DELETE)
assertEquals("hello", text)
}
@Test fun `emoji text input and delete`() {
reset()
input("🕵🏼")
functionalKeyPress(KeyCode.DELETE)
assertEquals("", text)
reset()
input("\uD83D\uDD75\uD83C\uDFFC")
input(' ')
assertEquals("🕵🏼 ", text)
functionalKeyPress(KeyCode.DELETE)
functionalKeyPress(KeyCode.DELETE)
assertEquals("", text)
}
// ------- helper functions ---------
// should be called before every test, so the same state is guaranteed