Sha256: a8ebf4e60dd22fc78a768e51e6b4a81673b77664ee7d21d93058a9eb82b1d971

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::Type::Uri do
  it "has special editor" do
    assert_view_select render_editor("Uri"),
                       'input[type="text"][class~="card-content"]'
  end

  it "renders core view links" do
    card = Card.create(type: "URI", name: "A URI card",
                       content: "http://wagn.org/Home")
    assert_view_select(
      card.format.render("core"),
      'a[class="external-link"][href="http://wagn.org/Home"]'
    ) do
      assert_select 'span[class="card-title"]', text: "A URI card"
    end
  end

  it "renders core view links with title arg" do
    card = Card.create(type: "URI", name: "A URI card",
                       content: "http://wagn.org/Home")


    assert_view_select(
      card.format.render("core", title: "My Title"),
      'a[class="external-link"][href="http://wagn.org/Home"]'
    ) do
      assert_select 'span[class="card-title"]', text: "My Title"
    end
  end

  it "renders title view in a plain formatter" do
    card = Card["A"]
    expect(card.format(:text).render("title", title: "My Title"))
      .to eq "My Title"
    expect(card.format(:text).render("title")).to eq "A"
  end

  it "renders url_link for regular cards" do
    card = Card["A"]
    expect(card.format(:text).render("url_link")).to eq "/A"
    assert_view_select card.format.render("url_link"),
                       'a[class="internal-link"][href="/A"]',
                       text: "/A"
  end

  it "renders a url_link view" do
    card = Card.create(type: "URI", name: "A URI card",
                       content: "http://wagn.org/Home")
    assert_view_select card.format.render("url_link"),
                       'a[class="external-link"]',
                       text: "http://wagn.org/Home"
    expect(card.format(:text).render("url_link")).to eq "http://wagn.org/Home"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
card-1.20.4 mod/standard/spec/set/type/uri_spec.rb
card-1.20.3 mod/standard/spec/set/type/uri_spec.rb
card-1.20.2 mod/standard/spec/set/type/uri_spec.rb
card-1.20.1 mod/standard/spec/set/type/uri_spec.rb
card-1.20.0 mod/standard/spec/set/type/uri_spec.rb