fix the server form's required-field errors

Flag the field that is actually blank instead of one combined "Name and address are
required", and focus it so it scrolls clear of the keyboard. The connection/save status
moves above the buttons in the ime-padded bottom bar, where the keyboard cannot hide it.
This commit is contained in:
austinried
2026-10-04 00:30:00 +00:00
parent d21b646858
commit 9f250d49f2
3 changed files with 79 additions and 26 deletions
@@ -0,0 +1,22 @@
package com.subtracks.ui.settings
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class AddSourceValidationTest {
@Test
fun flagsOnlyTheMissingFields() {
val missingName = AddSourceState(name = "", address = "https://music.example.com").validated()
assertTrue("a blank name should be flagged", missingName.nameError)
assertFalse("a present address should not be flagged", missingName.addressError)
val missingAddress = AddSourceState(name = "Home", address = "").validated()
assertFalse("a present name should not be flagged", missingAddress.nameError)
assertTrue("a blank address should be flagged", missingAddress.addressError)
val complete = AddSourceState(name = "Home", address = "https://music.example.com").validated()
assertFalse(complete.nameError)
assertFalse(complete.addressError)
}
}