mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user