Sha256: 97fe4cb3c828a815035483b89704efe0d27de5b1ceeeab0f7ea776e08cc988d1

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

require 'test_helper'

module PushType
  class MarkdownFieldTest < ActiveSupport::TestCase

    class TestPage < PushType::Node
      field :foo, :markdown
    end

    let(:node)  { TestPage.create FactoryBot.attributes_for(:node, foo: md) }
    let(:md)    { '**foo** *bar*' }
    let(:field) { node.fields[:foo] }
    
    it { field.form_helper.must_equal :text_area }
    it { field.json_value.must_equal md }
    it { field.value.must_equal md }
    it { field.compiled_value.strip.must_equal '<p><strong>foo</strong> <em>bar</em></p>' }

    it { node.foo.must_equal md }
    it { node.present!.foo.strip.must_equal '<p><strong>foo</strong> <em>bar</em></p>' }

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
push_type_core-0.12.1 test/fields/push_type/markdown_field_test.rb
push_type_core-0.12.0 test/fields/push_type/markdown_field_test.rb
push_type_core-0.12.0.beta.1 test/fields/push_type/markdown_field_test.rb