Sha256: f57745ea87169073ef2b10ea500ddb40f4bbb29119b346356a1e19bc10014826

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AutoHtml::TagHelper do
  it 'generates tag with attributes' do
    result = subject.tag(:img, src: '1.png', alt: 'number one!')
    expect(result).to eq '<img src="1.png" alt="number one!" />'
  end

  it 'generates tag without attributes' do
    result = subject.tag(:br)
    expect(result).to eq '<br />'
  end

  it 'generates content tags' do
    result = subject.tag(:label, for: 'name') { 'Name' }
    expect(result).to eq '<label for="name">Name</label>'
  end

  it 'generates content tags without attributes' do
    result = subject.tag(:label) { 'Username' }
    expect(result).to eq '<label>Username</label>'
  end

  it 'generates nested tags' do
    result = subject.tag(:form) { subject.tag(:input, type: 'text') }
    expect(result).to eq '<form><input type="text" /></form>'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
auto_html-2.2.0 spec/auto_html/tag_helper_spec.rb
auto_html-2.1.1 spec/auto_html/tag_helper_spec.rb
auto_html-2.1.0 spec/auto_html/tag_helper_spec.rb
auto_html-2.0.2 spec/auto_html/tag_helper_spec.rb