DEV: Fix a constant redefinition warning (#20842)
This commit is contained in:
parent
142ef6088c
commit
65b1381575
|
@ -5,6 +5,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
|
||||||
|
|
||||||
let(:chat_page) { PageObjects::Pages::Chat.new }
|
let(:chat_page) { PageObjects::Pages::Chat.new }
|
||||||
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
||||||
|
let(:key_modifier) { RUBY_PLATFORM =~ /darwin/i ? :meta : :control }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
chat_system_bootstrap
|
chat_system_bootstrap
|
||||||
|
@ -12,13 +13,11 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
|
||||||
visit("/")
|
visit("/")
|
||||||
end
|
end
|
||||||
|
|
||||||
KEY_MODIFIER = RUBY_PLATFORM =~ /darwin/i ? :meta : :control
|
|
||||||
|
|
||||||
context "when used with public channel" do
|
context "when used with public channel" do
|
||||||
fab!(:channel_1) { Fabricate(:category_channel) }
|
fab!(:channel_1) { Fabricate(:category_channel) }
|
||||||
|
|
||||||
it "works" do
|
it "works" do
|
||||||
find("body").send_keys([KEY_MODIFIER, "k"])
|
find("body").send_keys([key_modifier, "k"])
|
||||||
find("#chat-channel-selector-input").fill_in(with: channel_1.title)
|
find("#chat-channel-selector-input").fill_in(with: channel_1.title)
|
||||||
find(".chat-channel-selection-row[data-id='#{channel_1.id}']").click
|
find(".chat-channel-selection-row[data-id='#{channel_1.id}']").click
|
||||||
channel_page.send_message("Hello world")
|
channel_page.send_message("Hello world")
|
||||||
|
@ -31,7 +30,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
|
||||||
fab!(:user_1) { Fabricate(:user) }
|
fab!(:user_1) { Fabricate(:user) }
|
||||||
|
|
||||||
it "works" do
|
it "works" do
|
||||||
find("body").send_keys([KEY_MODIFIER, "k"])
|
find("body").send_keys([key_modifier, "k"])
|
||||||
find("#chat-channel-selector-input").fill_in(with: user_1.username)
|
find("#chat-channel-selector-input").fill_in(with: user_1.username)
|
||||||
find(".chat-channel-selection-row[data-id='#{user_1.id}']").click
|
find(".chat-channel-selection-row[data-id='#{user_1.id}']").click
|
||||||
channel_page.send_message("Hello world")
|
channel_page.send_message("Hello world")
|
||||||
|
@ -44,7 +43,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
|
||||||
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user]) }
|
fab!(:dm_channel_1) { Fabricate(:direct_message_channel, users: [current_user]) }
|
||||||
|
|
||||||
it "works" do
|
it "works" do
|
||||||
find("body").send_keys([KEY_MODIFIER, "k"])
|
find("body").send_keys([key_modifier, "k"])
|
||||||
find("#chat-channel-selector-input").fill_in(with: current_user.username)
|
find("#chat-channel-selector-input").fill_in(with: current_user.username)
|
||||||
find(".chat-channel-selection-row[data-id='#{dm_channel_1.id}']").click
|
find(".chat-channel-selection-row[data-id='#{dm_channel_1.id}']").click
|
||||||
channel_page.send_message("Hello world")
|
channel_page.send_message("Hello world")
|
||||||
|
@ -58,7 +57,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
|
||||||
|
|
||||||
it "it doesn’t include current channel" do
|
it "it doesn’t include current channel" do
|
||||||
chat_page.visit_channel(channel_1)
|
chat_page.visit_channel(channel_1)
|
||||||
find("body").send_keys([KEY_MODIFIER, "k"])
|
find("body").send_keys([key_modifier, "k"])
|
||||||
find("#chat-channel-selector-input").click
|
find("#chat-channel-selector-input").click
|
||||||
|
|
||||||
expect(page).to have_no_css(".chat-channel-selection-row[data-id='#{channel_1.id}']")
|
expect(page).to have_no_css(".chat-channel-selection-row[data-id='#{channel_1.id}']")
|
||||||
|
@ -71,7 +70,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true do
|
||||||
|
|
||||||
it "it doesn’t include limited access channel" do
|
it "it doesn’t include limited access channel" do
|
||||||
chat_page.visit_channel(channel_1)
|
chat_page.visit_channel(channel_1)
|
||||||
find("body").send_keys([KEY_MODIFIER, "k"])
|
find("body").send_keys([key_modifier, "k"])
|
||||||
find("#chat-channel-selector-input").fill_in(with: channel_1.title)
|
find("#chat-channel-selector-input").fill_in(with: channel_1.title)
|
||||||
|
|
||||||
expect(page).to have_no_css(".chat-channel-selection-row[data-id='#{channel_1.id}']")
|
expect(page).to have_no_css(".chat-channel-selection-row[data-id='#{channel_1.id}']")
|
||||||
|
|
|
@ -6,8 +6,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
|
||||||
|
|
||||||
let(:chat) { PageObjects::Pages::Chat.new }
|
let(:chat) { PageObjects::Pages::Chat.new }
|
||||||
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
||||||
|
let(:key_modifier) { RUBY_PLATFORM =~ /darwin/i ? :meta : :control }
|
||||||
KEY_MODIFIER = RUBY_PLATFORM =~ /darwin/i ? :meta : :control
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
chat_system_bootstrap
|
chat_system_bootstrap
|
||||||
|
@ -25,7 +24,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
|
||||||
chat.visit_channel(channel_1)
|
chat.visit_channel(channel_1)
|
||||||
|
|
||||||
within(".chat-composer-input") do |composer|
|
within(".chat-composer-input") do |composer|
|
||||||
composer.send_keys([KEY_MODIFIER, "b"])
|
composer.send_keys([key_modifier, "b"])
|
||||||
|
|
||||||
expect(composer.value).to eq("**strong text**")
|
expect(composer.value).to eq("**strong text**")
|
||||||
end
|
end
|
||||||
|
@ -37,7 +36,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
|
||||||
chat.visit_channel(channel_1)
|
chat.visit_channel(channel_1)
|
||||||
|
|
||||||
within(".chat-composer-input") do |composer|
|
within(".chat-composer-input") do |composer|
|
||||||
composer.send_keys([KEY_MODIFIER, "i"])
|
composer.send_keys([key_modifier, "i"])
|
||||||
|
|
||||||
expect(composer.value).to eq("_emphasized text_")
|
expect(composer.value).to eq("_emphasized text_")
|
||||||
end
|
end
|
||||||
|
@ -49,7 +48,7 @@ RSpec.describe "Shortcuts | chat composer", type: :system, js: true do
|
||||||
chat.visit_channel(channel_1)
|
chat.visit_channel(channel_1)
|
||||||
|
|
||||||
within(".chat-composer-input") do |composer|
|
within(".chat-composer-input") do |composer|
|
||||||
composer.send_keys([KEY_MODIFIER, "e"])
|
composer.send_keys([key_modifier, "e"])
|
||||||
|
|
||||||
expect(composer.value).to eq("`indent preformatted text by 4 spaces`")
|
expect(composer.value).to eq("`indent preformatted text by 4 spaces`")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue