Sha256: 9732a5d9f897f4bf198578bca775a8730801d3b8e228914eabb4e23125fc9ac2

Contents?: true

Size: 1.84 KB

Versions: 12

Compression:

Stored size: 1.84 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~="d0-card-content"]'
  end

  it "renders core view links" do
    card = Card.create(type: "URI", name: "A URI card",
                       content: "https://decko.org/Home")
    assert_view_select(
      card.format.render!("core"),
      'a[class="external-link"][href="https://decko.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: "https://decko.org/Home")

    assert_view_select(
      card.format.render!("core", title: "My Title"),
      'a[class="external-link"][href="https://decko.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: "https://decko.org/Home")
    assert_view_select card.format.render!("url_link"),
                       'a[class="external-link"]',
                       text: "https://decko.org/Home"
    expect(card.format(:text).render!("url_link")).to eq "https://decko.org/Home"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-1.98.3 mod/standard/spec/set/type/uri_spec.rb
card-1.98.2 mod/standard/spec/set/type/uri_spec.rb
card-1.98.1 mod/standard/spec/set/type/uri_spec.rb
card-1.98.0 mod/standard/spec/set/type/uri_spec.rb
card-1.97.0.1 mod/standard/spec/set/type/uri_spec.rb
card-1.97.0 mod/standard/spec/set/type/uri_spec.rb
card-1.96.8 mod/standard/spec/set/type/uri_spec.rb
card-1.96.7 mod/standard/spec/set/type/uri_spec.rb
card-1.96.6 mod/standard/spec/set/type/uri_spec.rb
card-1.96.5 mod/standard/spec/set/type/uri_spec.rb
card-1.96.4 mod/standard/spec/set/type/uri_spec.rb
card-1.96.3 mod/standard/spec/set/type/uri_spec.rb