test_file_selector.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright 2023 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_file_selector_md(gui: Gui, test_client, helpers):
  13. gui._bind_var_val("content", None)
  14. md_string = "<|{content}|file_selector|label=label|on_action=action|>"
  15. expected_list = [
  16. "<FileSelector",
  17. 'updateVarName="tpec_TpExPr_content_TPMDL_0"',
  18. 'label="label"',
  19. 'onAction="action"',
  20. ]
  21. helpers.test_control_md(gui, md_string, expected_list)
  22. def test_file_selector_html(gui: Gui, test_client, helpers):
  23. gui._bind_var_val("content", None)
  24. html_string = '<taipy:file_selector content="{content}" label="label" on_action="action" />'
  25. expected_list = [
  26. "<FileSelector",
  27. 'updateVarName="tpec_TpExPr_content_TPMDL_0"',
  28. 'label="label"',
  29. 'onAction="action"',
  30. ]
  31. helpers.test_control_html(gui, html_string, expected_list)