mirror of
https://github.com/discourse/discourse.git
synced 2025-04-02 23:50:30 +08:00
UX: plugins may have underscore in the name (#27749)
For example, https://github.com/discourse/docker_manager
This commit is contained in:
parent
f86a95d282
commit
52a047a8be
app/assets/javascripts
@ -55,7 +55,7 @@ export default class AdminPlugin {
|
||||
name = this.translatedCategoryName;
|
||||
} else {
|
||||
name = this.name
|
||||
.split("-")
|
||||
.split(/[-_]/)
|
||||
.map((word) => {
|
||||
return capitalize(word);
|
||||
})
|
||||
|
@ -0,0 +1,19 @@
|
||||
import { setupTest } from "ember-qunit";
|
||||
import { module, test } from "qunit";
|
||||
import AdminPlugin from "admin/models/admin-plugin";
|
||||
|
||||
module("Unit | Model | admin plugin", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test("nameTitleized", function (assert) {
|
||||
const adminPlugin = AdminPlugin.create({
|
||||
name: "docker_manager",
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
adminPlugin.nameTitleized,
|
||||
"Docker Manager",
|
||||
"it should return titleized name replacing underscores with spaces"
|
||||
);
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user