mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 16:33:59 +08:00
FIX: Fix delete button for Tag Groups. (#6965)
This commit is contained in:
parent
0337622420
commit
e0e91fad87
|
@ -9,6 +9,11 @@ export default RestModel.extend({
|
|||
return saving || Ember.isEmpty(name) || Ember.isEmpty(tagNames);
|
||||
},
|
||||
|
||||
@computed("id")
|
||||
disableDelete(id) {
|
||||
return !parseInt(id);
|
||||
},
|
||||
|
||||
@computed("permissions")
|
||||
permissionName: {
|
||||
get(permissions) {
|
||||
|
|
|
@ -44,6 +44,6 @@
|
|||
</section>
|
||||
|
||||
<button {{action "save"}} disabled={{model.disableSave}} class='btn btn-default'>{{i18n 'tagging.groups.save'}}</button>
|
||||
<button {{action "destroy"}} disabled={{model.disableSave}} class='btn btn-danger'>{{d-icon "far-trash-alt"}} {{i18n 'tagging.groups.delete'}}</button>
|
||||
<button {{action "destroy"}} disabled={{model.disableDelete}} class='btn btn-danger'>{{d-icon "far-trash-alt"}} {{i18n 'tagging.groups.delete'}}</button>
|
||||
<span class="saving {{unless model.savingStatus 'hidden'}}">{{model.savingStatus}}</span>
|
||||
</div>
|
||||
|
|
36
test/javascripts/acceptance/tag-groups-test.js.es6
Normal file
36
test/javascripts/acceptance/tag-groups-test.js.es6
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Tag Groups", {
|
||||
loggedIn: true,
|
||||
settings: { tagging_enabled: true },
|
||||
pretend(server, helper) {
|
||||
server.post("/tag_groups", () => {
|
||||
return helper.response({
|
||||
tag_group: {
|
||||
id: 42,
|
||||
name: "test tag group",
|
||||
tag_names: ["monkey"],
|
||||
parent_tag_name: [],
|
||||
one_per_topic: false,
|
||||
permissions: { everyone: 1 }
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("tag groups can be saved and deleted", async assert => {
|
||||
const tags = selectKit(".tag-chooser");
|
||||
|
||||
await visit("/tag_groups");
|
||||
await click(".content-list .btn");
|
||||
|
||||
await fillIn(".tag-group-content h1 input", "test tag group");
|
||||
await tags.expand();
|
||||
await tags.selectRowByValue("monkey");
|
||||
|
||||
await click(".tag-group-content .btn.btn-default");
|
||||
|
||||
await click(".tag-chooser .choice:first");
|
||||
assert.ok(!find(".tag-group-content .btn.btn-danger")[0].disabled);
|
||||
});
|
Loading…
Reference in New Issue
Block a user