fixed number settings 0 max validator

This commit is contained in:
Gani Georgiev
2026-06-08 12:41:13 +03:00
parent b66a4e32cc
commit f868756721
3 changed files with 52 additions and 14 deletions
+31 -7
View File
@@ -237,7 +237,7 @@ func TestNumberFieldValidateSettings(t *testing.T) {
[]string{},
},
{
"decumal min",
"decimal min",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
@@ -248,7 +248,7 @@ func TestNumberFieldValidateSettings(t *testing.T) {
[]string{},
},
{
"decumal min (onlyInt)",
"decimal min (onlyInt)",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
@@ -272,7 +272,7 @@ func TestNumberFieldValidateSettings(t *testing.T) {
[]string{},
},
{
"decumal max",
"decimal max",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
@@ -283,7 +283,7 @@ func TestNumberFieldValidateSettings(t *testing.T) {
[]string{},
},
{
"decumal max (onlyInt)",
"decimal max (onlyInt)",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
@@ -307,19 +307,31 @@ func TestNumberFieldValidateSettings(t *testing.T) {
[]string{},
},
{
"min > max",
"min > max (0)",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
Name: "test",
Min: types.Pointer(2.0),
Max: types.Pointer(1.0),
Max: types.Pointer(0.0),
}
},
[]string{"max"},
},
{
"min <= max",
"min (0) > max",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
Name: "test",
Min: types.Pointer(0.0),
Max: types.Pointer(-1.0),
}
},
[]string{"max"},
},
{
"min == max",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
@@ -330,6 +342,18 @@ func TestNumberFieldValidateSettings(t *testing.T) {
},
[]string{},
},
{
"min < max",
func() *core.NumberField {
return &core.NumberField{
Id: "test",
Name: "test",
Min: types.Pointer(2.0),
Max: types.Pointer(3.0),
}
},
[]string{},
},
}
for _, s := range scenarios {