diff options
Diffstat (limited to 'datavalidation_test.go')
-rw-r--r-- | datavalidation_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/datavalidation_test.go b/datavalidation_test.go index c245df3..d70b874 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -85,3 +85,20 @@ func TestDataValidationError(t *testing.T) { f = NewFile() assert.EqualError(t, f.AddDataValidation("SheetN", nil), "sheet SheetN is not exist") } + +func TestDeleteDataValidation(t *testing.T) { + f := NewFile() + assert.NoError(t, f.DeleteDataValidation("Sheet1", "A1:B2")) + + dvRange := NewDataValidation(true) + dvRange.Sqref = "A1:B2" + assert.NoError(t, dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorBetween)) + dvRange.SetInput("input title", "input body") + assert.NoError(t, f.AddDataValidation("Sheet1", dvRange)) + + assert.NoError(t, f.DeleteDataValidation("Sheet1", "A1:B2")) + assert.NoError(t, f.SaveAs(filepath.Join("test", "TestDeleteDataValidation.xlsx"))) + + // Test delete data validation on no exists worksheet. + assert.EqualError(t, f.DeleteDataValidation("SheetN", "A1:B2"), "sheet SheetN is not exist") +} |