Sha256: 2044dd42fa2ad63abdb60496a8f63055c62a9bdf0fe09a5672de32bbffb35d9f

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'rails_helper'
feature "Richtext editing", js: true do
  background do
    auth_as_user
  end

  scenario "Image toolbar available when controller support attachments" do
    visit new_admin_node_path(content_type: 'TextPage')
    wait_for_all_richtexts
    fill_in_richtext 'Text', with: "some text"
    expect(page).to have_css("a.cke_button__image")
  end

  scenario "Image toolbar unavailable when controller doesn't support attachments" do
    allow_any_instance_of(Admin::BooksController).to receive(:releaf_richtext_attachment_upload_url).and_return("")
    visit new_admin_book_path
    wait_for_all_richtexts
    fill_in_richtext "Summary", with: "some text"
    expect(page).to_not have_css("a.cke_button__image")
  end

  scenario "Test helper fills in correct value" do
    visit new_admin_node_path(content_type: 'TextPage')
    html = %Q[ <p class="xxx" id="yyy">&quot;HTML&quot; &#39;content&#39;</p> ]
    wait_for_all_richtexts
    fill_in_richtext 'Text', with: html
    content = evaluate_script('CKEDITOR.instances["resource_content_attributes_text_html"].getData();')
    expect(content).to match_html html
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
releaf-core-2.0.0 spec/features/richtext_spec.rb