Sha256: 9a9d132147edec2895cbbb03a98a2aacaf6fd8d67629f894ddebc70cff5f3420

Contents?: true

Size: 1.14 KB

Versions: 9

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-autohide=\"true\" class=\"my-toast toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\"><div class=\"my-header-toast toast-header\"><i class=\"mr-2 glyph fas fa-eye\"></i><strong class=\"mr-auto\">My header toast</strong><small class=\"text-muted\">Now</small><button class=\"ml-2 mb-1 btn-close\" data-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

9 entries across 9 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.alpha12 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha11 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha10 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha9 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha8 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha6 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha5 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha3 test/ui/core/notifications/toast_test.rb
ui_bibz-3.0.0.alpha2 test/ui/core/notifications/toast_test.rb