mirror of
https://github.com/discourse/discourse.git
synced 2024-12-20 01:33:53 +08:00
694b5f108b
These (21 + 3 from previous PRs) are soon to be enabled in rubocop-discourse: Capybara/VisibilityMatcher Lint/DeprecatedOpenSSLConstant Lint/DisjunctiveAssignmentInConstructor Lint/EmptyConditionalBody Lint/EmptyEnsure Lint/LiteralInInterpolation Lint/NonLocalExitFromIterator Lint/ParenthesesAsGroupedExpression Lint/RedundantCopDisableDirective Lint/RedundantRequireStatement Lint/RedundantSafeNavigation Lint/RedundantStringCoercion Lint/RedundantWithIndex Lint/RedundantWithObject Lint/SafeNavigationChain Lint/SafeNavigationConsistency Lint/SelfAssignment Lint/UnreachableCode Lint/UselessMethodDefinition Lint/Void Previous PRs: Lint/ShadowedArgument Lint/DuplicateMethods Lint/BooleanSymbol RSpec/SpecFilePathSuffix
40 lines
1.2 KiB
Ruby
40 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
||
|
||
RSpec.describe "Channel message selection", type: :system do
|
||
fab!(:current_user) { Fabricate(:user) }
|
||
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||
fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) }
|
||
|
||
let(:chat) { PageObjects::Pages::Chat.new }
|
||
let(:channel) { PageObjects::Pages::ChatChannel.new }
|
||
let(:image) do
|
||
Fabricate(
|
||
:upload,
|
||
original_filename: "test_image.jpg",
|
||
width: 400,
|
||
height: 300,
|
||
extension: "jpg",
|
||
)
|
||
end
|
||
|
||
before do
|
||
chat_system_bootstrap
|
||
channel_1.add(current_user)
|
||
sign_in(current_user)
|
||
message_1.uploads = [image]
|
||
end
|
||
|
||
it "can collapse/expand an image and still have lightbox working" do
|
||
chat.visit_channel(channel_1)
|
||
|
||
find(".chat-message-collapser-button").click
|
||
expect(page).to have_css(".chat-message-collapser-body.hidden", visible: :hidden)
|
||
find(".chat-message-collapser-button").click
|
||
expect(page).to have_no_css(".chat-message-collapser-body.hidden")
|
||
find(".chat-img-upload").click
|
||
|
||
# visible false is because the upload doesn’t exist but it's enough to know lightbox is working
|
||
expect(page).to have_css(".mfp-image-holder img[src*='#{image.url}']", visible: :hidden)
|
||
end
|
||
end
|