From 94ce5445ad5a90544ef8865b1a6ddc6d32873df9 Mon Sep 17 00:00:00 2001 From: Grace Kind Date: Mon, 2 Feb 2026 22:57:47 -0600 Subject: [PATCH] Flesh out template tests --- src/js/templates/avatar.template.js | 3 +- src/js/templates/externalLink.template.js | 17 +- src/js/templates/largePost.template.js | 4 +- src/js/templates/postActionBar.template.js | 7 +- src/js/templates/postEmbed.template.js | 13 +- src/js/templates/postHeaderText.template.js | 15 +- src/js/templates/postSkeleton.template.js | 2 +- src/js/templates/profileCard.template.js | 22 +- src/js/templates/richText.template.js | 2 +- src/js/templates/smallPost.template.js | 7 +- tests/specs/templates/avatar.template.test.js | 117 +++++-- .../templates/largePost.template.test.js | 148 ++++++++- .../templates/postActionBar.template.test.js | 218 ++++++++++++- .../templates/postEmbed.template.test.js | 158 +++++++++- .../templates/postHeaderText.template.test.js | 99 +++++- .../templates/postSkeleton.template.test.js | 28 +- .../templates/profileCard.template.test.js | 290 ++++++++++++++++-- .../specs/templates/richText.template.test.js | 54 +++- .../templates/smallPost.template.test.js | 238 +++++++++++++- 19 files changed, 1346 insertions(+), 96 deletions(-) diff --git a/src/js/templates/avatar.template.js b/src/js/templates/avatar.template.js index 3b3bbc1e..8c079ceb 100644 --- a/src/js/templates/avatar.template.js +++ b/src/js/templates/avatar.template.js @@ -38,7 +38,7 @@ export function avatarTemplate({ }) { const isLabeler = isLabelerProfile(author); const avatarUrl = getAvatarUrl(author, isLabeler); - return html`
+ return html`
${avatarWrapperTemplate({ author, clickAction, @@ -48,6 +48,7 @@ export function avatarTemplate({ src="${avatarUrl}" alt="${author.displayName} profile picture" class=${classnames("avatar-image", { "labeler-avatar": isLabeler })} + data-testid="avatar-image" loading=${lazyLoad ? "lazy" : "eager"} />`, ), diff --git a/src/js/templates/externalLink.template.js b/src/js/templates/externalLink.template.js index 54310576..2a7d2615 100644 --- a/src/js/templates/externalLink.template.js +++ b/src/js/templates/externalLink.template.js @@ -12,7 +12,7 @@ export function externalLinkTemplate({ image, lazyLoadImages, }) { - return html`