Skip to content

Commit

Permalink
add migration logic for category_lock_icon
Browse files Browse the repository at this point in the history
  • Loading branch information
tyb-talks committed Dec 23, 2024
1 parent 609126c commit 4e24b34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export default function migrate(settings) {
return props.join(",");
},
svg_icons: (icon) => convertIconName(icon),
category_lock_icon: (icon) => convertIconName(icon),
};
const settingNames = ["category_icon_list", "svg_icons"];
const settingNames = ["category_icon_list", "svg_icons", "category_lock_icon"];

settingNames.forEach((settingName) => {
const oldSetting = settings.get(settingName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { module, test } from "qunit";
import migrate from "../../../../migrations/settings/0001-migrate-from-deprecated-icon-names.js";
import migrate from "../../../../migrations/settings/0001-migrate-from-deprecated-icon-names";

module(
"Unit | Migrations | Settings | 0001-migrate-from-deprecated-icon-names.js",
"Unit | Migrations | Settings | 0001-migrate-from-deprecated-icon-names",
function () {
test("migrate", function (assert) {
const settings = new Map(
Object.entries({
category_icon_list:
"meta,fab-facebook,#CC0000,partial|x,fab-twitter,#CC0011,full|config,fab-cog,#CC0012,partial|group,user-friends,#CC0001,",
"meta,fab-facebook,#CC0000,partial|x,fab-twitter,#CC0011,full|config,fab fa-cog,#CC0012,partial|group,user-friends,#CC0001,",
svg_icons: "fab-facebook|fab-twitter|fab-cog|user-friends",
category_lock_icon: "fas fa-lock-alt",
})
);

Expand All @@ -18,8 +19,9 @@ module(
const expectedResult = new Map(
Object.entries({
category_icon_list:
"meta,fab-facebook,#CC0000,partial|x,fab-twitter,#CC0011,full|config,fab fa-gear,#CC0012,partial|group,user-group,#CC0001,",
"meta,fab-facebook,#CC0000,partial|x,fab-twitter,#CC0011,full|config,fab-gear,#CC0012,partial|group,user-group,#CC0001,",
svg_icons: "fab-facebook|fab-twitter|fab-gear|user-group",
category_lock_icon: "lock-keyhole",
})
);
assert.deepEqual(Array.from(result), Array.from(expectedResult));
Expand Down

0 comments on commit 4e24b34

Please sign in to comment.