richtext_spec.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. require 'rails_helper'
  2. RSpec.describe 'Richtext', type: :system do
  3. before do
  4. click(:href, '#current_user')
  5. click(:href, '#layout_ref')
  6. click(:href, '#layout_ref/richtext')
  7. end
  8. context 'Richtext' do
  9. it 'Single line mode' do
  10. element = find('#content .text-1')
  11. element.send_keys(
  12. 'some test for browser ',
  13. :enter,
  14. 'and some other for browser'
  15. )
  16. expect(element).to have_content('some test for browser and some other for browser')
  17. end
  18. it 'Multi line mode' do
  19. element = find('#content .text-5')
  20. element.send_keys(
  21. 'some test for browser ',
  22. :enter,
  23. 'and some other for browser'
  24. )
  25. expect(element).to have_content(%r{some test for browser\s?\nand some other for browser})
  26. end
  27. end
  28. context 'Regular text' do
  29. it 'Multi line mode' do
  30. element = find('#content .text-3')
  31. element.send_keys(
  32. 'some test for browser ',
  33. :enter,
  34. 'and some other for browser'
  35. )
  36. expect(element).to have_content(%r{some test for browser\s?\nand some other for browser})
  37. end
  38. end
  39. end