openstreetmap-website/test/integration/user_changeset_comments_test.rb
Andy Allan c8f0a81eb7 Rework sidebar to use padding on the sidebar_content div
This saves every header, list, paragraph etc having to sort out their own padding. The couple of instances where we want edge-to-edge can be acheived using the negative margin spacing utilities.

The padding is based on $spacer so that it can be adjusted automatically via bootstrap configuration.

This also means that we can remove many (mis-)uses of the browse-section class, which is only supposed to be for cases where there are multiple browse-sections in sequence (e.g. multiple nodes in the node history browse pages).
2021-06-16 15:45:58 +01:00

55 lines
1.5 KiB
Ruby

require "test_helper"
class UserChangesetCommentsTest < ActionDispatch::IntegrationTest
# Test 'log in to comment' message for nonlogged in user
def test_log_in_message
changeset = create(:changeset, :closed)
get "/changeset/#{changeset.id}"
assert_response :success
assert_select "div#content" do
assert_select "div#sidebar" do
assert_select "div#sidebar_content" do
assert_select "div" do
assert_select "div.notice" do
assert_select "a[href='/login?referer=%2Fchangeset%2F#{changeset.id}']", :text => I18n.t("browse.changeset.join_discussion"), :count => 1
end
end
end
end
end
end
# Test if the form is shown
def test_displaying_form
user = create(:user)
changeset = create(:changeset, :closed)
get "/login"
follow_redirect!
# We should now be at the login page
assert_response :success
assert_template "sessions/new"
# We can now login
post "/login", :params => { "username" => user.email, "password" => "test" }
assert_response :redirect
get "/changeset/#{changeset.id}"
assert_response :success
assert_template "browse/changeset"
assert_select "div#content" do
assert_select "div#sidebar" do
assert_select "div#sidebar_content" do
assert_select "div" do
assert_select "form[action='#']" do
assert_select "textarea[name=text]"
end
end
end
end
end
end
end