+48
-1
@@ -6,7 +6,11 @@ import requests
|
||||
from uuid import uuid4
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from playwright.sync_api import expect
|
||||
from tests.conftest import BASE_URL, assert_share_copies
|
||||
from tests.conftest import (
|
||||
BASE_URL,
|
||||
assert_no_horizontal_overflow,
|
||||
assert_share_copies,
|
||||
)
|
||||
from devplacepy.database import get_table
|
||||
from devplacepy.utils import make_combined_slug
|
||||
DPBOT_SIZE = 112147
|
||||
@@ -473,3 +477,46 @@ def test_gists_list_preserves_comment_hierarchy(page, app_server):
|
||||
expect(card.locator(".post-card-comments")).not_to_contain_text(f"{marker}-excluded")
|
||||
nested = card.locator(".post-card-comments .comment-replies .comment-text")
|
||||
expect(nested).to_contain_text(f"{marker}-reply")
|
||||
|
||||
|
||||
def _seed_gist_with_long_code_line():
|
||||
owner = str(uuid4())
|
||||
get_table("users").insert(
|
||||
{
|
||||
"uid": owner,
|
||||
"username": f"gcode_{owner[:8]}",
|
||||
"email": f"{owner[:8]}@gcode.seed",
|
||||
"password_hash": "x",
|
||||
"role": "Member",
|
||||
"is_active": True,
|
||||
"created_at": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
)
|
||||
uid = str(uuid4())
|
||||
marker = f"gistcode-{uid[:8]}"
|
||||
line = "unbreakable_identifier_" * 8
|
||||
get_table("gists").insert(
|
||||
{
|
||||
"deleted_at": None,
|
||||
"deleted_by": None,
|
||||
"uid": uid,
|
||||
"user_uid": owner,
|
||||
"slug": make_combined_slug(marker, uid),
|
||||
"title": marker,
|
||||
"description": f"```python\n{line}\n```",
|
||||
"source_code": "print('x')",
|
||||
"language": "python",
|
||||
"stars": 0,
|
||||
"created_at": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
)
|
||||
return marker
|
||||
|
||||
|
||||
def test_gists_long_code_line_does_not_widen_layout(page, app_server):
|
||||
marker = _seed_gist_with_long_code_line()
|
||||
page.goto(f"{BASE_URL}/gists", wait_until="domcontentloaded")
|
||||
card = page.locator(".gist-card").filter(has_text=marker).first
|
||||
card.wait_for(state="visible")
|
||||
assert card.locator("pre").count() == 1
|
||||
assert_no_horizontal_overflow(page, ".gists-layout")
|
||||
|
||||
Reference in New Issue
Block a user