зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-04 10:45:51 +03:00
Add specs for editor in nested resources
Этот коммит содержится в:
@@ -9,7 +9,7 @@ RSpec.describe 'Quill editor', type: :system do
|
||||
end
|
||||
|
||||
after do
|
||||
post.destroy
|
||||
Post.destroy_all
|
||||
author.destroy
|
||||
end
|
||||
|
||||
@@ -18,6 +18,7 @@ RSpec.describe 'Quill editor', type: :system do
|
||||
visit "/admin/posts/#{post.id}/edit"
|
||||
|
||||
expect(page).to have_css('#post_description_input .ql-editor', text: 'Some content...')
|
||||
find('#post_description_input .ql-editor').click
|
||||
find('#post_description_input .ql-editor').base.send_keys('more text')
|
||||
|
||||
find('[type="submit"]').click
|
||||
@@ -25,4 +26,21 @@ RSpec.describe 'Quill editor', type: :system do
|
||||
expect(post.reload.description).to eq '<p>Some content...more text</p>'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a Quill editor in a nested resource' do
|
||||
it 'updates some HTML content of a new nested resource' do
|
||||
visit "/admin/authors/#{author.id}/edit"
|
||||
|
||||
expect(page).to have_css('.posts.has_many_container .ql-editor', text: 'Some content...')
|
||||
find('.posts.has_many_container .has_many_add').click
|
||||
expect(page).to have_css('.posts.has_many_container .ql-editor', count: 2)
|
||||
|
||||
fill_in('author[posts_attributes][1][title]', with: 'A new post')
|
||||
find('#author_posts_attributes_1_description_input .ql-editor').base.send_keys('new post text')
|
||||
find('[type="submit"]').click
|
||||
|
||||
expect(page).to have_content('was successfully updated')
|
||||
expect(author.posts.last.description).to eq '<p>new post text</p>'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user