1
0

test_indicator.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright 2021-2024 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. from taipy.gui import Gui
  12. def test_indicator_md(gui: Gui, test_client, helpers):
  13. gui._bind_var_val("val", 15)
  14. md_string = "<|12|indicator|value={val}|min=1|max=20|format=%.2f|>"
  15. expected_list = [
  16. "<Indicator",
  17. 'libClassName="taipy-indicator"',
  18. "defaultValue={15}",
  19. "display={12.0}",
  20. 'format="%.2f"',
  21. "max={20.0}",
  22. "min={1.0}",
  23. "value={_TpN_tpec_TpExPr_val_TPMDL_0}",
  24. ]
  25. helpers.test_control_md(gui, md_string, expected_list)
  26. def test_menu_html(gui: Gui, test_client, helpers):
  27. gui._bind_var_val("val", 15)
  28. html_string = '<taipy:indicator value="{val}" min="1" max="20" format="%.2f" >12</taipy:indicator>'
  29. expected_list = [
  30. "<Indicator",
  31. 'libClassName="taipy-indicator"',
  32. "defaultValue={15}",
  33. "display={12.0}",
  34. 'format="%.2f"',
  35. "max={20.0}",
  36. "min={1.0}",
  37. "value={_TpN_tpec_TpExPr_val_TPMDL_0}",
  38. ]
  39. helpers.test_control_html(gui, html_string, expected_list)