Sha256: 4e6c897ce2dc335cb796e6a5b4ad6bbfcc0b685f455cc889ce345df1d59e0d7b

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

require_relative 'test_helper'
require_relative 'abstract_unit'
require_relative '../lib/helpers/default'
require_relative '../lib/helpers/textile_editor_initialize'
require 'ostruct'

class TextileEditorHelperTest  < MiniTest::Unit::TestCase

  include ActionView::Helpers::TextHelper
  include ActionView::Helpers::AssetTagHelper
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::FormHelper
  include ActionView::Helpers::JavaScriptHelper

  include SupportMethods

  def create_editor(object, field, options={})
    output = textile_editor(object, field, options)
    assert_equal  text_area(object, field, options.merge(:class => "textile_editor")), output
  end

  def expected_initialize_output
    TextileEditorInitialize.textile_editor_initialize
  end

  # Tests
  def test_textile_editor
    create_editor('article', 'body')
    assert_includes textile_editor('article', 'body'), "textile_editor"
  end

  def test_textile_editor_initialize
    create_editor('article', 'body')
    output = textile_editor_initialize()
    assert_equal expected_initialize_output, output
  end

  def test_textile_editor_initialize_with_custom_buttons
    b = '<button id="test_button" title="Hello world">Hello</button>'
    button_data = ["TextileEditor.buttons.push(""#{b}"");" ]
    actual = textile_editor_button('Hello',
                                   :id => 'test_button',
                                   :title => 'Hello world'
                                  )

    assert_equal button_data, actual

    create_editor('article', 'body')
    output = textile_editor_initialize()
    assert_equal expected_initialize_output, output
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
textile_editor_helper-0.1.1 test/textile_editor_helper_test.rb
textile_editor_helper-0.1.0 test/textile_editor_helper_test.rb
textile_editor_helper-0.0.31 test/textile_editor_helper_test.rb
textile_editor_helper-0.0.30 test/textile_editor_helper_test.rb