test_layout.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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_layout_md_1(gui: Gui, helpers):
  13. md_string = """
  14. <|layout|columns=1 1|gap=1rem|
  15. # This is a layout section
  16. |>
  17. """
  18. expected_list = ["<Layout", 'columns="1 1', 'gap="1rem"', "<h1", "This is a layout section"]
  19. helpers.test_control_md(gui, md_string, expected_list)
  20. def test_layout_md_2(gui: Gui, helpers):
  21. md_string = """
  22. <|layout.start|columns=1 1|gap=1rem|>
  23. # This is a layout section
  24. <|layout.end|>
  25. """
  26. expected_list = ["<Layout", 'columns="1 1', 'gap="1rem"', "<h1", "This is a layout section"]
  27. helpers.test_control_md(gui, md_string, expected_list)
  28. def test_layout_html(gui: Gui, helpers):
  29. html_string = '<taipy:layout columns="1 1" gap="1rem"><h1>This is a layout section</h1></taipy:layout>'
  30. expected_list = ["<Layout", 'columns="1 1', 'gap="1rem"', "<h1", "This is a layout section"]
  31. helpers.test_control_html(gui, html_string, expected_list)