'Holy guacamole! You should check in on some of those fields below.',
'options' => [
'class' => ['alert-warning'],
],
]);
$expectedHtml = <<
Holy guacamole! You should check in on some of those fields below.
HTML;
$this->assertEqualsWithoutLE($expectedHtml, $html);
}
public function testDismissibleAlert()
{
Alert::$counter = 0;
$html = Alert::widget([
'body' => "Message1",
]);
$expectedHtml = <<
Message1
HTML;
$this->assertEqualsWithoutLE($expectedHtml, $html);
}
/**
* @see https://github.com/yiisoft/yii2-bootstrap5/issues/11
*/
public function testDismissibleAlertCustomButton()
{
Alert::$counter = 0;
$html = Alert::widget([
'body' => "Low Blow: Bob Loblaw's Law Blog Lobs Law Bomb",
'options' => [
'class' => 'alert-warning',
],
'closeButton' => [
'label' => 'Dismiss',
'tag' => 'a',
'class' => [
'widget' => 'btn btn-outline-warning',
],
'style' => [
'position' => 'absolute',
'top' => '.5rem',
'right' => '.5rem',
],
],
]);
$expectedHtml = <<
Low Blow: Bob Loblaw's Law Blog Lobs Law Bomb
Dismiss
HTML;
$this->assertEqualsWithoutLE($expectedHtml, $html);
}
}