Spaces:
Running
Running
Daryl Lim Claude Opus 4.6 (1M context) commited on
Commit ·
1a73708
1
Parent(s): 2f45b6a
test: add layout alignment tests and clean up blank lines
Browse filesAdd tests verifying the new UI state: translate button is outside both
columns, no HTML elements remain. Remove extra blank lines left from
earlier test removals.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- tests/test_app.py +14 -4
tests/test_app.py
CHANGED
|
@@ -178,6 +178,20 @@ def test_demo_has_translate_button(demo):
|
|
| 178 |
assert any(b.value == "Translate" for b in buttons), "Expected a 'Translate' button"
|
| 179 |
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
|
| 183 |
def test_translate_handlers_wire_text_and_language(demo):
|
|
@@ -188,10 +202,6 @@ def test_translate_handlers_wire_text_and_language(demo):
|
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
def test_no_title(demo):
|
| 196 |
"""UI should not have an H1 title."""
|
| 197 |
markdowns = [b for b in demo.blocks.values() if type(b).__name__ == "Markdown"]
|
|
|
|
| 178 |
assert any(b.value == "Translate" for b in buttons), "Expected a 'Translate' button"
|
| 179 |
|
| 180 |
|
| 181 |
+
def test_translate_button_outside_columns(demo):
|
| 182 |
+
"""Translate button should not be inside either Column."""
|
| 183 |
+
buttons = [b for b in demo.blocks.values() if type(b).__name__ == "Button" and b.value == "Translate"]
|
| 184 |
+
assert len(buttons) == 1
|
| 185 |
+
node = getattr(buttons[0], "parent", None)
|
| 186 |
+
while node is not None:
|
| 187 |
+
assert type(node).__name__ != "Column", "Translate button should not be inside a Column"
|
| 188 |
+
node = getattr(node, "parent", None)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def test_demo_has_no_html_elements(demo):
|
| 192 |
+
"""UI should have no HTML elements (hint/char count removed)."""
|
| 193 |
+
html_blocks = [b for b in demo.blocks.values() if type(b).__name__ == "HTML"]
|
| 194 |
+
assert len(html_blocks) == 0, f"Expected no HTML blocks, found {len(html_blocks)}"
|
| 195 |
|
| 196 |
|
| 197 |
def test_translate_handlers_wire_text_and_language(demo):
|
|
|
|
| 202 |
|
| 203 |
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
def test_no_title(demo):
|
| 206 |
"""UI should not have an H1 title."""
|
| 207 |
markdowns = [b for b in demo.blocks.values() if type(b).__name__ == "Markdown"]
|