|
9 | 9 | end |
10 | 10 |
|
11 | 11 | after do |
12 | | - Post.destroy_all |
13 | | - author.destroy |
| 12 | + Post.delete_all |
| 13 | + author.delete |
14 | 14 | end |
15 | 15 |
|
16 | 16 | context 'with a Quill editor' do |
17 | | - it 'updates some HTML content' do |
| 17 | + it 'initialize the editor' do |
18 | 18 | visit "/admin/posts/#{post.id}/edit" |
19 | 19 |
|
20 | 20 | %w[bold italic underline link].each do |button| |
21 | 21 | expect(page).to have_css(".ql-toolbar button.ql-#{button}") |
22 | 22 | end |
23 | 23 | expect(page).to have_css('#post_description[data-aa-quill-editor]') |
24 | 24 | expect(page).to have_css('#post_description_input .ql-editor', text: 'Some content...') |
| 25 | + end |
| 26 | + |
| 27 | + it 'adds some text to the description' do |
| 28 | + visit "/admin/posts/#{post.id}/edit" |
| 29 | + |
25 | 30 | find('#post_description_input .ql-editor').click |
26 | 31 | find('#post_description_input .ql-editor').base.send_keys('more text') |
27 | | - |
28 | 32 | find('[type="submit"]').click |
29 | 33 | expect(page).to have_content('was successfully updated') |
30 | 34 | expect(post.reload.description).to eq '<p>Some content...more text</p>' |
31 | 35 | end |
| 36 | + |
| 37 | + it 'adds some bold text to the description' do |
| 38 | + visit "/admin/posts/#{post.id}/edit" |
| 39 | + |
| 40 | + find('#post_description_input .ql-editor').click |
| 41 | + find('#post_description_input .ql-toolbar .ql-bold').click |
| 42 | + find('#post_description_input .ql-editor').base.send_keys('more text') |
| 43 | + find('[type="submit"]').click |
| 44 | + expect(post.reload.description).to eq '<p>Some content...<strong>more text</strong></p>' |
| 45 | + end |
| 46 | + |
| 47 | + it 'adds some italic text to the description' do |
| 48 | + visit "/admin/posts/#{post.id}/edit" |
| 49 | + |
| 50 | + find('#post_description_input .ql-editor').click |
| 51 | + find('#post_description_input .ql-toolbar .ql-italic').click |
| 52 | + find('#post_description_input .ql-editor').base.send_keys('more text') |
| 53 | + find('[type="submit"]').click |
| 54 | + expect(post.reload.description).to eq '<p>Some content...<em>more text</em></p>' |
| 55 | + end |
32 | 56 | end |
33 | 57 |
|
34 | 58 | context 'with a Quill editor in a nested resource' do |
|
0 commit comments