Update TagMetadata CSS classes to use brand colours with translucent backgrounds matching the wireframe design: - cyan: bg-brand-cyan/10 text-brand-cyan - pink: bg-brand-pink/10 text-brand-pink - neutral: bg-zinc-800 text-white (dark: bg-zinc-100 text-black) Previously used muted Tailwind defaults (bg-cyan-100/text-cyan-900) which appeared as soft pastels instead of the intended neon look. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import pytest
|
|
from django.db import IntegrityError
|
|
from taggit.models import Tag
|
|
|
|
from apps.blog.models import ArticleIndexPage, ArticlePage, HomePage, TagMetadata
|
|
from apps.blog.tests.factories import AuthorFactory
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_home_page_creation(home_page):
|
|
assert HomePage.objects.count() == 1
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_article_index_parent_restriction():
|
|
assert ArticleIndexPage.parent_page_types == ["blog.HomePage"]
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_article_compute_read_time_excludes_code(home_page):
|
|
index = ArticleIndexPage(title="Articles", slug="articles")
|
|
home_page.add_child(instance=index)
|
|
author = AuthorFactory()
|
|
article = ArticlePage(
|
|
title="A",
|
|
slug="a",
|
|
author=author,
|
|
summary="s",
|
|
body=[("rich_text", "<p>one two three</p>"), ("code", {"language": "python", "raw_code": "x y z"})],
|
|
)
|
|
index.add_child(instance=article)
|
|
article.save()
|
|
assert article.read_time_mins == 1
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_tag_metadata_css_and_uniqueness():
|
|
tag = Tag.objects.create(name="llms", slug="llms")
|
|
meta = TagMetadata.objects.create(tag=tag, colour="cyan")
|
|
assert meta.get_css_classes()["bg"] == "bg-brand-cyan/10"
|
|
with pytest.raises(IntegrityError):
|
|
TagMetadata.objects.create(tag=tag, colour="pink")
|