This repository was archived by the owner on Jun 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 143
/
Copy pathconftest.py
220 lines (208 loc) · 8.06 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# -*- coding: utf-8 -*-
from datetime import datetime
import pytest
import dash
import dash_core_components as dcc
import dash_html_components as html
OPTIONS = [
{"label": "New York City", "value": "NYC"},
{"label": u"Montréal", "value": "MTL"},
{"label": "San Francisco", "value": "SF"},
{"label": u"北京", "value": u"帝都"},
{"label": u"臺北", "value": u"天龍國"},
]
@pytest.fixture(scope="module")
def platter_app():
app = dash.Dash(__name__)
app.layout = html.Div(
[
html.Div(id="waitfor"),
html.Label("Upload"),
dcc.Upload(),
html.Label("Horizontal Tabs"),
dcc.Tabs(
id="tabs",
children=[
dcc.Tab(
label="Tab one",
className="test",
style={"border": "1px solid magenta"},
children=[html.Div(["Test"])],
),
dcc.Tab(
label="Tab two",
children=[
html.Div(
[
html.H1("This is the content in tab 2"),
html.P("A graph here would be nice!"),
]
)
],
id="tab-one",
),
dcc.Tab(
label="Tab three",
children=[html.Div([html.H1("This is the content in tab 3")])],
),
],
style={"fontFamily": "system-ui"},
content_style={"border": "1px solid #d6d6d6", "padding": "44px"},
parent_style={"maxWidth": "1000px", "margin": "0 auto"},
),
html.Label("Vertical Tabs"),
dcc.Tabs(
id="tabs1",
vertical=True,
children=[
dcc.Tab(label="Tab one", children=[html.Div(["Test"])]),
dcc.Tab(
label="Tab two",
children=[
html.Div(
[
html.H1("This is the content in tab 2"),
html.P("A graph here would be nice!"),
]
)
],
),
dcc.Tab(
label="Tab three",
children=[html.Div([html.H1("This is the content in tab 3")])],
),
],
),
html.Label("Dropdown"),
dcc.Dropdown(options=OPTIONS, value="MTL", id="dropdown"),
html.Label("Multi-Select Dropdown"),
dcc.Dropdown(options=OPTIONS, value=["MTL", "SF"], multi=True),
html.Label("Radio Items"),
dcc.RadioItems(options=OPTIONS, value="MTL"),
html.Label("Checkboxes"),
dcc.Checklist(options=OPTIONS, value=["MTL", "SF"]),
html.Label("Text Input"),
dcc.Input(value="", placeholder="type here", id="textinput"),
html.Label("Disabled Text Input"),
dcc.Input(
value="disabled", type="text", id="disabled-textinput", disabled=True,
),
html.Label("Slider"),
dcc.Slider(
min=0,
max=9,
marks={
i: "Label {}".format(i) if i == 1 else str(i) for i in range(1, 6)
},
value=5,
),
html.Label("Graph"),
dcc.Graph(
id="graph",
figure={
"data": [{"x": [1, 2, 3], "y": [4, 1, 4]}],
"layout": {"title": u"北京"},
},
),
html.Div(
[
html.Label("DatePickerSingle"),
dcc.DatePickerSingle(
id="date-picker-single", date=datetime(1997, 5, 10)
),
html.Div(
[
html.Label("DatePickerSingle - empty input"),
dcc.DatePickerSingle(),
],
id="dt-single-no-date-value",
),
html.Div(
[
html.Label(
"DatePickerSingle - initial visible month (May 97)"
),
dcc.DatePickerSingle(
initial_visible_month=datetime(1997, 5, 10)
),
],
id="dt-single-no-date-value-init-month",
),
]
),
html.Div(
[
html.Label("DatePickerRange"),
dcc.DatePickerRange(
id="date-picker-range",
start_date_id="startDate",
end_date_id="endDate",
start_date=datetime(1997, 5, 3),
end_date_placeholder_text="Select a date!",
),
html.Div(
[
html.Label("DatePickerRange - empty input"),
dcc.DatePickerRange(
start_date_id="startDate",
end_date_id="endDate",
start_date_placeholder_text="Start date",
end_date_placeholder_text="End date",
),
],
id="dt-range-no-date-values",
),
html.Div(
[
html.Label(
"DatePickerRange - initial visible month (May 97)"
),
dcc.DatePickerRange(
start_date_id="startDate",
end_date_id="endDate",
start_date_placeholder_text="Start date",
end_date_placeholder_text="End date",
initial_visible_month=datetime(1997, 5, 10),
),
],
id="dt-range-no-date-values-init-month",
),
]
),
html.Label("TextArea"),
dcc.Textarea(placeholder="Enter a value... 北京", style={"width": "100%"}),
html.Label("Markdown"),
dcc.Markdown(
"""
#### Dash and Markdown
Dash supports [Markdown](https://rexxars.github.io/react-markdown/).
Markdown is a simple way to write and format text.
It includes a syntax for things like **bold text** and *italics*,
[links](https://rexxars.github.io/react-markdown/), inline `code` snippets, lists,
quotes, and more.
1. Links are auto-rendered: https://dash.plotly.com.
2. This uses ~commonmark~ GitHub flavored markdown.
Tables are also supported:
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
北京
""".replace(
" ", ""
)
),
dcc.Markdown(["# Line one", "## Line two"]),
dcc.Markdown(),
dcc.Markdown(
"""
```py
import python
print(3)
```"""
),
dcc.Markdown(["```py", "import python", "print(3)", "```"]),
dcc.Markdown(),
]
)
yield app