mirror of
https://github.com/discourse/discourse.git
synced 2025-06-22 01:34:06 +08:00
spec fixes
This commit is contained in:
@ -84,6 +84,10 @@ export default {
|
|||||||
return htmlSafe(emojiUnescape(this.channel.escapedTitle));
|
return htmlSafe(emojiUnescape(this.channel.escapedTitle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get prefixType() {
|
||||||
|
return "icon";
|
||||||
|
}
|
||||||
|
|
||||||
get prefixValue() {
|
get prefixValue() {
|
||||||
return "d-chat";
|
return "d-chat";
|
||||||
}
|
}
|
||||||
@ -102,18 +106,6 @@ export default {
|
|||||||
return this.channel.chatable.read_restricted ? "lock" : "";
|
return this.channel.chatable.read_restricted ? "lock" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
get prefixCSSClass() {
|
|
||||||
const activeUsers = this.chatService.presenceChannel.users;
|
|
||||||
const user = this.channel.chatable.users[0];
|
|
||||||
if (
|
|
||||||
!!activeUsers?.findBy("id", user?.id) ||
|
|
||||||
!!activeUsers?.findBy("username", user?.username)
|
|
||||||
) {
|
|
||||||
return "active";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
get suffixType() {
|
get suffixType() {
|
||||||
return "icon";
|
return "icon";
|
||||||
}
|
}
|
||||||
@ -304,7 +296,6 @@ export default {
|
|||||||
|
|
||||||
get prefixCSSClass() {
|
get prefixCSSClass() {
|
||||||
const activeUsers = this.chatService.presenceChannel.users;
|
const activeUsers = this.chatService.presenceChannel.users;
|
||||||
console.log(this.channel.chatable);
|
|
||||||
const user = getFirstUser(
|
const user = getFirstUser(
|
||||||
this.channel.chatable.users,
|
this.channel.chatable.users,
|
||||||
this.currentUser
|
this.currentUser
|
||||||
|
@ -159,6 +159,8 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
|
|||||||
context "as staff" do
|
context "as staff" do
|
||||||
fab!(:current_user) { Fabricate(:admin) }
|
fab!(:current_user) { Fabricate(:admin) }
|
||||||
|
|
||||||
|
before { channel_1.add(current_user) }
|
||||||
|
|
||||||
it "can edit name" do
|
it "can edit name" do
|
||||||
chat_page.visit_channel_settings(channel_1)
|
chat_page.visit_channel_settings(channel_1)
|
||||||
|
|
||||||
@ -170,7 +172,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
|
|||||||
|
|
||||||
edit_modal.fill_and_save_name(name)
|
edit_modal.fill_and_save_name(name)
|
||||||
|
|
||||||
expect(channel_settings_page).to have_name(name)
|
expect(page).to have_content(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can edit description" do
|
it "can edit description" do
|
||||||
@ -191,6 +193,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
|
|||||||
|
|
||||||
it "can edit slug" do
|
it "can edit slug" do
|
||||||
chat_page.visit_channel_settings(channel_1)
|
chat_page.visit_channel_settings(channel_1)
|
||||||
|
|
||||||
edit_modal = channel_settings_page.open_edit_modal
|
edit_modal = channel_settings_page.open_edit_modal
|
||||||
|
|
||||||
slug = "gonzo-slug"
|
slug = "gonzo-slug"
|
||||||
@ -199,7 +202,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
|
|||||||
|
|
||||||
edit_modal.fill_and_save_slug(slug)
|
edit_modal.fill_and_save_slug(slug)
|
||||||
|
|
||||||
expect(channel_settings_page).to have_slug(slug)
|
expect(page).to have_current_path("/chat/c/gonzo-slug/#{channel_1.id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can clear the slug to use the autogenerated version based on the name" do
|
it "can clear the slug to use the autogenerated version based on the name" do
|
||||||
@ -213,7 +216,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
|
|||||||
edit_modal.wait_for_auto_generated_slug
|
edit_modal.wait_for_auto_generated_slug
|
||||||
edit_modal.save_changes
|
edit_modal.save_changes
|
||||||
|
|
||||||
expect(channel_settings_page).to have_slug("test-channel")
|
expect(page).to have_current_path("/chat/c/test-channel/#{channel_1.id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows settings page" do
|
it "shows settings page" do
|
||||||
|
Reference in New Issue
Block a user