Skip to content

Commit f9db291

Browse files
committed
Add a test for 'options_with_unique_values' validator.
1 parent e3aa8d9 commit f9db291

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/development/test_component_validation.py

+19
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def make_validator(schema):
5555
'validator': 'plotly_figure'
5656
}
5757
})
58+
self.options_validator = make_validator({
59+
'options': {
60+
'validator': 'options_with_unique_values'
61+
}
62+
})
5863

5964
def test_component_in_initial_layout_is_validated(self):
6065
app = dash.Dash(__name__)
@@ -486,3 +491,17 @@ def test_figure_validation(self):
486491
self.assertFalse(self.figure_validator.validate({
487492
'figure': None
488493
}))
494+
495+
def test_options_validation(self):
496+
self.assertFalse(self.options_validator.validate({
497+
'options': [
498+
{'value': 'value1', 'label': 'label1'},
499+
{'value': 'value1', 'label': 'label1'}
500+
]
501+
}))
502+
self.assertTrue(self.options_validator.validate({
503+
'options': [
504+
{'value': 'value1', 'label': 'label1'},
505+
{'value': 'value2', 'label': 'label2'}
506+
]
507+
}))

0 commit comments

Comments
 (0)