Sha256: 07fb8e5f45fe4d62a69bc6f998edf7c67c8ab3b4df36a24c4d42475e79a9b17c

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require 'test_helper'
class AlertTest < ActionView::TestCase
  include UiBibz::Helpers::Ui::CoreHelper

  test 'alert' do
    actual = ui_alert 'state'
    expected = '<div class="alert-info alert alert-dismissible" role="alert">state</div>'

    assert_equal expected, actual
  end

  test 'alert with more informaton' do
    actual = ui_alert(status: :success, glyph: 'thumbs-o-up', closable: true) do |a|
      a.header 'Information'
      a.body 'Body text'
    end
    expected = "<div class=\"alert-success alert alert-dismissible\" role=\"alert\"><h4 class=\"alert-header\"><i class=\"glyph fas fa-thumbs-o-up\"></i>  Information<button type=\"button\" class=\"btn-close\" data-dismiss=\"alert\" aria-label=\"Close\"></button></h4><hr /><p class=\"alert-body mb-0\">Body text</p></div>"

    assert_equal expected, actual
  end

  test 'alert with timeout' do
    actual = ui_alert 'timeout', timeout: 500
    expected = '<div data-timeout="500" class="alert-info alert alert-dismissible" role="alert">timeout</div>'

    assert_equal expected, actual
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.alpha8 test/ui/core/notifications/alert_test.rb
ui_bibz-3.0.0.alpha6 test/ui/core/notifications/alert_test.rb
ui_bibz-3.0.0.alpha5 test/ui/core/notifications/alert_test.rb
ui_bibz-3.0.0.alpha3 test/ui/core/notifications/alert_test.rb
ui_bibz-3.0.0.alpha2 test/ui/core/notifications/alert_test.rb