Merge remote-tracking branch 'parent/main' into upstream-20240123

This commit is contained in:
KMY 2025-01-23 18:10:34 +09:00
commit 50ae2d9439
320 changed files with 2587 additions and 2817 deletions

View file

@ -26,8 +26,8 @@ RSpec.describe 'OCR', :attachment_processing, :inline_jobs, :js, :streaming do
end
end
click_on('Detect text from picture')
click_on('Add text from image')
expect(page).to have_css('#upload-modal__description', text: /Hello Mastodon\s*/, wait: 10)
expect(page).to have_css('#description', text: /Hello Mastodon\s*/, wait: 10)
end
end

View file

@ -5,8 +5,6 @@ require 'rails_helper'
RSpec.describe 'Profile' do
include ProfileStories
subject { page }
let(:local_domain) { Rails.configuration.x.local_domain }
before do
@ -17,7 +15,8 @@ RSpec.describe 'Profile' do
it 'I can view public account page for Alice' do
visit account_path('alice')
expect(subject).to have_title("alice (@alice@#{local_domain})")
expect(page)
.to have_title("alice (@alice@#{local_domain})")
end
it 'I can change my account' do
@ -26,8 +25,31 @@ RSpec.describe 'Profile' do
fill_in 'Display name', with: 'Bob'
fill_in 'Bio', with: 'Bob is silent'
first('button[type=submit]').click
fill_in 'account_fields_attributes_0_name', with: 'Personal Website'
fill_in 'account_fields_attributes_0_value', with: 'https://host.example/personal'
expect(subject).to have_content 'Changes successfully saved!'
fill_in 'account_fields_attributes_1_name', with: 'Professional Biography'
fill_in 'account_fields_attributes_1_value', with: 'https://host.example/pro'
expect { submit_form }
.to change { bob.account.reload.display_name }.to('Bob')
.and(change_account_fields)
expect(page)
.to have_content 'Changes successfully saved!'
end
def submit_form
first('button[type=submit]').click
end
def change_account_fields
change { bob.account.reload.fields }
.from([])
.to(
contain_exactly(
be_a(Account::Field),
be_a(Account::Field)
)
)
end
end

View file

@ -15,12 +15,27 @@ RSpec.describe 'Settings verification page' do
.to have_content(verification_summary)
.and have_private_cache_control
fill_in attribution_field, with: 'host.example'
fill_in attribution_field, with: " example.com\n\n https://example.net"
expect { click_on submit_button }
.to(change { user.account.reload.attribution_domains_as_text })
.to(change { user.account.reload.attribution_domains }.to(['example.com', 'example.net']))
expect(page)
.to have_content(success_message)
expect(find_field(attribution_field).value)
.to have_content("example.com\nexample.net")
end
it 'rejects invalid attribution domains' do
visit settings_verification_path
fill_in attribution_field, with: "example.com \n invalid_com"
expect { click_on submit_button }
.to_not(change { user.account.reload.attribution_domains })
expect(page)
.to have_content(I18n.t('activerecord.errors.messages.invalid_domain_on_line', value: 'invalid_com'))
expect(find_field(attribution_field).value)
.to have_content("example.com\ninvalid_com")
end
end
@ -29,6 +44,6 @@ RSpec.describe 'Settings verification page' do
end
def attribution_field
I18n.t('simple_form.labels.account.attribution_domains_as_text')
I18n.t('simple_form.labels.account.attribution_domains')
end
end