@@ -1190,3 +1190,111 @@ def test_listing_meta_tags_omit_description_when_absent(
11901190
11911191 assert '<meta name="description"' not in html
11921192 assert '<meta property="og:description"' not in html
1193+
1194+ def test_draft_post_page_has_emoji_and_class (
1195+ self , sample_draft_post : Post
1196+ ) -> None :
1197+ """Test that a draft post page shows the 🚧 emoji and draft-post class."""
1198+ renderer = TemplateRenderer ()
1199+ html = renderer .render_post (sample_draft_post , site_title = "Test Blog" )
1200+
1201+ assert "🚧" in html
1202+ assert "draft-post" in html
1203+
1204+ def test_non_draft_post_page_has_no_emoji_or_class (
1205+ self , sample_post : Post
1206+ ) -> None :
1207+ """Test that a non-draft post page does not show the 🚧 emoji or draft-post class."""
1208+ renderer = TemplateRenderer ()
1209+ html = renderer .render_post (sample_post , site_title = "Test Blog" )
1210+
1211+ assert "🚧" not in html
1212+ assert "draft-post" not in html
1213+
1214+ def test_draft_post_index_has_emoji_and_class (
1215+ self , sample_draft_post : Post
1216+ ) -> None :
1217+ """Test that a draft post in the index shows the 🚧 emoji and draft-post class."""
1218+ renderer = TemplateRenderer ()
1219+ html = renderer .render_index (
1220+ posts = [sample_draft_post ],
1221+ page = 1 ,
1222+ total_pages = 1 ,
1223+ site_title = "Test Blog" ,
1224+ )
1225+
1226+ assert "🚧" in html
1227+ assert "draft-post" in html
1228+
1229+ def test_non_draft_post_index_has_no_emoji_or_class (
1230+ self , sample_post : Post
1231+ ) -> None :
1232+ """Test that a non-draft post in the index does not show the 🚧 emoji or draft-post class."""
1233+ renderer = TemplateRenderer ()
1234+ html = renderer .render_index (
1235+ posts = [sample_post ],
1236+ page = 1 ,
1237+ total_pages = 1 ,
1238+ site_title = "Test Blog" ,
1239+ )
1240+
1241+ assert "🚧" not in html
1242+ assert "draft-post" not in html
1243+
1244+ def test_draft_post_tag_page_has_emoji_and_class (
1245+ self , sample_draft_post : Post
1246+ ) -> None :
1247+ """Test that a draft post on a tag page shows the 🚧 emoji and draft-post class."""
1248+ renderer = TemplateRenderer ()
1249+ html = renderer .render_tag_page (
1250+ tag = "draft" ,
1251+ posts = [sample_draft_post ],
1252+ site_title = "Test Blog" ,
1253+ )
1254+
1255+ assert "🚧" in html
1256+ assert "draft-post" in html
1257+
1258+ def test_draft_post_category_page_has_emoji_and_class (
1259+ self , sample_draft_post : Post
1260+ ) -> None :
1261+ """Test that a draft post on a category page shows the 🚧 emoji and draft-post class."""
1262+ renderer = TemplateRenderer ()
1263+ html = renderer .render_category_page (
1264+ category = "webdev" ,
1265+ posts = [sample_draft_post ],
1266+ site_title = "Test Blog" ,
1267+ )
1268+
1269+ assert "🚧" in html
1270+ assert "draft-post" in html
1271+
1272+ def test_draft_post_archive_has_emoji_and_class (
1273+ self , sample_draft_post : Post
1274+ ) -> None :
1275+ """Test that a draft post on the archive page shows the 🚧 emoji and draft-title class."""
1276+ renderer = TemplateRenderer ()
1277+ # Render the main archive page (no archive_title) to exercise the
1278+ # compact list view that uses the draft-title CSS class.
1279+ html = renderer .render_archive (
1280+ posts = [sample_draft_post ],
1281+ site_title = "Test Blog" ,
1282+ )
1283+
1284+ assert "🚧" in html
1285+ assert "draft-title" in html
1286+
1287+ def test_non_draft_post_archive_has_no_emoji_or_class (
1288+ self , sample_post : Post
1289+ ) -> None :
1290+ """Test that a non-draft post on the archive page does not show the 🚧 emoji or draft-title class."""
1291+ renderer = TemplateRenderer ()
1292+ # Render the main archive page (no archive_title) to exercise the
1293+ # compact list view that uses the draft-title CSS class.
1294+ html = renderer .render_archive (
1295+ posts = [sample_post ],
1296+ site_title = "Test Blog" ,
1297+ )
1298+
1299+ assert "🚧" not in html
1300+ assert "draft-title" not in html
0 commit comments