diff --git a/app/assets/javascripts/discourse/app/lib/icon-library.js b/app/assets/javascripts/discourse/app/lib/icon-library.js
index b1553031155..d107a52e0f8 100644
--- a/app/assets/javascripts/discourse/app/lib/icon-library.js
+++ b/app/assets/javascripts/discourse/app/lib/icon-library.js
@@ -1,7 +1,11 @@
import { h } from "virtual-dom";
import attributeHook from "discourse/lib/attribute-hook";
import deprecated from "discourse/lib/deprecated";
-import { isDevelopment } from "discourse/lib/environment";
+import {
+ isDevelopment,
+ isRailsTesting,
+ isTesting,
+} from "discourse/lib/environment";
import escape from "discourse/lib/escape";
import { i18n } from "discourse-i18n";
@@ -147,6 +151,7 @@ function handleDeprecatedIcon(id) {
{
id: "discourse.fontawesome-6-upgrade",
url: "https://meta.discourse.org/t/325349",
+ raiseError: isTesting() || isRailsTesting(),
}
);
}
@@ -189,12 +194,12 @@ registerIconRenderer({
}
html += ` xmlns="${SVG_NAMESPACE}">`;
if (params.label) {
- html += `${escape(params.label)}`;
+ html += `${escape(params.label)}`;
}
if (params.title) {
- html = `${html}`;
+ )}">${html}`;
}
if (params.translatedtitle) {
@@ -207,9 +212,9 @@ registerIconRenderer({
}
if (params.translatedTitle) {
- html = `${html}`;
+ )}">${html}`;
}
return html;
},
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js b/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js
index 6be36d87e8e..1c3df6d6dea 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js
@@ -6,6 +6,10 @@ import {
iconHTML,
iconNode,
} from "discourse/lib/icon-library";
+import {
+ disableRaiseOnDeprecation,
+ enableRaiseOnDeprecation,
+} from "discourse/tests/helpers/raise-on-deprecation";
module("Unit | Utility | icon-library", function (hooks) {
setupTest(hooks);
@@ -67,4 +71,24 @@ module("Unit | Utility | icon-library", function (hooks) {
);
});
});
+
+ test("fa5 remaps throws error", function (assert) {
+ disableRaiseOnDeprecation();
+ assert.throws(
+ () => {
+ iconHTML("adjust");
+ },
+ /Deprecation notice: The icon name "adjust" has been updated to "circle-half-stroke".*\[deprecation id: discourse\.fontawesome-6-upgrade\]/,
+ "throws an error if icon name is deprecated"
+ );
+
+ assert.throws(
+ () => {
+ iconHTML("far-dot-circle");
+ },
+ /Deprecation notice: The icon name "far-dot-circle" has been updated to "far-circle-dot".*\[deprecation id: discourse\.fontawesome-6-upgrade\]/,
+ "throws an error if icon name is deprecated"
+ );
+ enableRaiseOnDeprecation();
+ });
});
diff --git a/db/fixtures/006_badges.rb b/db/fixtures/006_badges.rb
index 735e86268bb..38943a72f45 100644
--- a/db/fixtures/006_badges.rb
+++ b/db/fixtures/006_badges.rb
@@ -173,7 +173,7 @@ end
Badge.seed do |b|
b.id = Badge::FirstShare
b.name = "First Share"
- b.default_icon = "share-alt"
+ b.default_icon = "share-nodes"
b.badge_type_id = BadgeType::Bronze
b.multiple_grant = false
b.target_posts = true
@@ -193,7 +193,7 @@ end
Badge.seed do |b|
b.id = id
b.name = name
- b.default_icon = "share-alt"
+ b.default_icon = "share-nodes"
b.badge_type_id = level
b.multiple_grant = true
b.target_posts = true
@@ -402,7 +402,7 @@ end
Badge.seed do |b|
b.id = Badge::FirstEmoji
b.name = "First Emoji"
- b.default_icon = "smile"
+ b.default_icon = "face-smile"
b.badge_type_id = BadgeType::Bronze
b.multiple_grant = false
b.target_posts = true