Sha256: d6f7d6f99781ac872f7b31068a8db59f962976eaf225af9755d35afdcdcbca28

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'test_helper'
include UiBibz::Helpers
class GridTest < ActionView::TestCase

  test 'row' do
    actual = UiBibz::Ui::Row.new() do
      'test'
    end.render
    expected = "<div class=\"row\">test</div>"

    assert_equal expected, actual
  end

  test 'col with simple arg' do
    actual = UiBibz::Ui::Col.new({ size: :lg, num: 1}) do
      'test'
    end.render
    expected = "<div class=\"col-lg-1\">test</div>"

    assert_equal expected, actual
  end

  test 'col with multiple args' do
    actual = UiBibz::Ui::Col.new([{ size: :lg, num: 1, offset: 2}, { num: 1 }], class: 'test') do
      'test'
    end.render
    expected = "<div class=\"test col-lg-1 col-offset-2 col-md-1\">test</div>"

    assert_equal expected, actual
  end

  test 'grid' do
    actual = UiBibz::Ui::Grid.new().tap do |g|
      g.view position: :left do
        'left'
      end
      g.view 'center', position: :center
      g.view 'right', position: :right
      g.view 'bottom', position: :bottom
    end.render
    expected = "<div class=\"grid row\"><div class=\"col grid-left col-md-1\">left</div><div class=\"col grid-center col-md-10\">center</div><div class=\"col grid-right col-md-1\">right</div><div class=\"col grid-bottom col-md-12\">bottom</div></div>"

    assert_equal expected, actual
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ui_bibz-1.0.0 test/ui/grid_test.rb
ui_bibz-0.9.0 test/ui/grid_test.rb