Sha256: dc907cea32dc63f60fddc62df3982abacf654fd0df33ed765f9a396b96d9d35c

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 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 fa-solid fa-thumbs-o-up\"></i> Information<button type=\"button\" class=\"btn-close\" data-bs-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

11 entries across 11 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta15 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta14 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta13 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta10 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta9 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta8 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta7 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta6 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta4 test/ui/core/notifications/alert_test.rb
ui_bibz-4.0.0.beta3 test/ui/core/notifications/alert_test.rb