cirandas.net

ref: master

plugins/comment_paragraph/test/unit/tinymce_helper_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require_relative '../test_helper'

class TinymceHelperTest < ActiveSupport::TestCase

  include TinymceHelper

  def setup
    expects(:top_url).returns('/')
    expects(:tinymce_language).returns('en')
    expects(:current_editor).returns(Article::Editor::TINY_MCE)
    @plugins = mock
    @plugins.expects(:dispatch).returns([]).at_least_once
    @environment = Environment.default
  end

  attr_accessor :top_url, :environment

  should 'set keep_styles to false in tinymce options' do
    environment.enable_plugin(CommentParagraphPlugin)
    assert_match /"keep_styles":false/, tinymce_init_js
  end

  should 'do not set keep_styles to false when plugin is not enabled' do
    environment.disable_plugin(CommentParagraphPlugin)
    assert_no_match /"keep_styles":false/, tinymce_init_js
  end

end