Sha256: 123643128d7457da4a1a1094f686e3a5eda9f2ed53a702541c1a385a79bb9832

Contents?: true

Size: 1.54 KB

Versions: 8

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe ReverseMarkdown::Mapper do

  let(:input)    { File.read('spec/assets/lists.html') }
  let(:document) { Nokogiri::HTML(input) }
  subject { ReverseMarkdown.parse_string(input) }

  it { should match /\n- unordered list entry\n/ }
  it { should match /\n- unordered list entry 2\n/ }
  it { should match /\n1. ordered list entry\n/ }
  it { should match /\n2. ordered list entry 2\n/ }
  it { should match /\n1. list entry 1st hierarchy\n/ }
  it { should match /\n {2}- nested unsorted list entry\n/ }
  it { should match /\n {4}1. deep nested list entry\n/ }

  context "nested list with no whitespace" do
    it { should match /\n- item a\n/ }
    it { should match /\n- item b\n/ }
    it { should match /\n {2}- item bb\n/ }
    it { should match /\n {2}- item bc\n/ }
  end

  context "nested list with lots of whitespace" do
    it { should match /\n- item wa\n/ }
    it { should match /\n- item wb\n/ }
    it { should match /\n {2}- item wbb\n/ }
    it { should match /\n {2}- item wbc\n/ }
  end

  context "lists containing links" do
    it { should match /\n- \[1 Basic concepts\]\(Basic_concepts\)\n/ }
    it { should match /\n- \[2 History of the idea\]\(History_of_the_idea\)\n/ }
    it { should match /\n- \[3 Intelligence explosion\]\(Intelligence_explosion\)\n/ }
  end

  context "lists containing embedded <p> tags" do
    xit { should match /\n- I want to have a party at my house!\n/ }
  end

  context "list item containing multiple <p> tags" do
    xit { should match /\n- li 1, p 1\n\n- li 1, p 2\n/ }
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reverse_markdown-0.4.7 spec/components/lists_spec.rb
reverse_markdown-0.4.6 spec/components/lists_spec.rb
reverse_markdown-0.4.5 spec/components/lists_spec.rb
reverse_markdown-0.4.4 spec/components/lists_spec.rb
reverse_markdown-0.4.3 spec/components/lists_spec.rb
reverse_markdown-0.4.2 spec/components/lists_spec.rb
reverse_markdown-0.4.1 spec/components/lists_spec.rb
reverse_markdown-0.4.0 spec/components/lists_spec.rb