added required validator for the TextField.Pattern option in case it is a primary key

This commit is contained in:
Gani Georgiev
2024-11-19 17:21:25 +02:00
parent 48328bf33f
commit 9fe4f87e5b
8 changed files with 31 additions and 9 deletions

View File

@@ -317,10 +317,23 @@ func TestTextFieldValidateSettings(t *testing.T) {
Id: "test",
Name: "id",
PrimaryKey: true,
Pattern: `\d+`,
}
},
[]string{"required"},
},
{
"primaryKey without pattern",
func() *core.TextField {
return &core.TextField{
Id: "test",
Name: "id",
PrimaryKey: true,
Required: true,
}
},
[]string{"pattern"},
},
{
"primaryKey with hidden",
func() *core.TextField {
@@ -330,6 +343,7 @@ func TestTextFieldValidateSettings(t *testing.T) {
Required: true,
PrimaryKey: true,
Hidden: true,
Pattern: `\d+`,
}
},
[]string{"hidden"},
@@ -342,6 +356,7 @@ func TestTextFieldValidateSettings(t *testing.T) {
Name: "test",
PrimaryKey: true,
Required: true,
Pattern: `\d+`,
}
},
[]string{"name"},
@@ -353,6 +368,7 @@ func TestTextFieldValidateSettings(t *testing.T) {
Id: "test2",
Name: "id",
PrimaryKey: true,
Pattern: `\d+`,
Required: true,
}
},