Sha256: ae591458a14f5545349116ec6a4bd04c585b5f3eff6c2353319607a59dfe1d7c

Contents?: true

Size: 979 Bytes

Versions: 17

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class CheckboxFieldTest < ActionView::TestCase
  test 'checkbox_field' do
    actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { value: 1, status: :primary }).render
    expected = "<div class=\"form-check\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input form-check-input-primary\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"

    assert_equal expected, actual
  end

  test 'checkbox_field which is a boolean' do
    actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { boolean: true, value: 1 }).render
    expected = "<div class=\"form-check\"><input type=\"hidden\" name=\"John\" id=\"John-hidden\" value=\"0\" /><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"

    assert_equal expected, actual
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.beta11 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta10 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta9 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta8 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta7 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta6 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta5 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta4 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta3 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta2 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.beta1 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.alpha12 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.alpha11 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.alpha10 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.alpha9 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.alpha8 test/ui/core/forms/choices/checkbox_field_test.rb
ui_bibz-3.0.0.alpha6 test/ui/core/forms/choices/checkbox_field_test.rb