Skip to content

Commit 596eb36

Browse files
committed
Add Slider.py test
1 parent d108349 commit 596eb36

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

chartlets.py/chartlets/components/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .radiogroup import Radio
1111
from .radiogroup import RadioGroup
1212
from .select import Select
13-
# from .slider import Slider
13+
from .slider import Slider
1414
from .switch import Switch
1515
from .tabs import Tab
1616
from .tabs import Tabs

chartlets.py/chartlets/components/slider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Slider(Component):
1717
colors
1818
"""
1919

20-
defaultValue: [int] | int | None = None
20+
defaultValue: list[int] | int | None = None
2121
"""The default value. Use when the component is not controlled. If used
2222
as an array, it will create multiple sliding points on the bar
2323
"""
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from chartlets.components import Slider
2+
from tests.component_test import make_base
3+
4+
5+
class SliderTest(make_base(Slider)):
6+
def test_is_json_serializable(self):
7+
self.assert_is_json_serializable(
8+
self.cls(
9+
aria_label="Temperature",
10+
color="primary",
11+
min=0,
12+
max=50,
13+
step=5,
14+
marks=[5, 15, 50],
15+
tooltip="Choose a temperature",
16+
valueLabelDisplay="on",
17+
),
18+
{
19+
"type": "Slider",
20+
"aria_label": "Temperature",
21+
"color": "primary",
22+
"min": 0,
23+
"max": 50,
24+
"step": 5,
25+
"marks": [5, 15, 50],
26+
"tooltip": "Choose a temperature",
27+
"valueLabelDisplay": "on",
28+
},
29+
)

0 commit comments

Comments
 (0)