Sha256: 903d806bea16aad6181bfb2ea6cfbb0e4ef079a4820b7897e062d04465a9cbf2

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

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

  test 'toast' do
    actual = ui_toast(auto_hide: true, class: 'my-toast') do |t|
      t.header 'My header toast', glyph: 'eye', time: 'Now', class: 'my-header-toast'
      t.body 'My body toast', class: 'my-body-toast'
    end
    expected = "<div data-bs-autohide=\"true\" class=\"my-toast toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"my-header-toast toast-header\"><i class=\"me-2 glyph fas fa-eye\"></i><strong class=\"me-auto\">My header toast</strong><small class=\"text-muted\">Now</small><button class=\"ml-2 mb-1 btn-close\" data-bs-dismiss=\"toast\" aria-label=\"Close\"></button></div><div class=\"my-body-toast toast-body\">My body toast</div></div>"

    assert_equal expected, actual
  end

  test 'toast without header and body' do
    actual = ui_toast do
      'My body toast'
    end
    expected = "<div class=\"toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"toast-body\">My body toast</div></div>"

    assert_equal expected, actual
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.beta16 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta15 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta14 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta13 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta12 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta11 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta10 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta9 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta8 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta7 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta6 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta5 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta4 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta3 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.beta2 test/ui/core/notifications/toast_test.rb