Skip to content

Commit

Permalink
Merge pull request #57 from eduardostuart/master
Browse files Browse the repository at this point in the history
Allow overlay message with custom level
  • Loading branch information
Laracasts committed Mar 14, 2016
2 parents 4df7200 + 540b43a commit 6031286
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Laracasts/Flash/FlashNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ public function warning($message)
*
* @param string $message
* @param string $title
* @param string $level
* @return $this
*/
public function overlay($message, $title = 'Notice')
public function overlay($message, $title = 'Notice', $level = 'info')
{
$this->message($message);
$this->message($message, $level);

$this->session->flash('flash_notification.overlay', true);
$this->session->flash('flash_notification.title', $title);
Expand Down
11 changes: 11 additions & 0 deletions tests/FlashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,15 @@ public function it_displays_flash_overlay_notifications()
$this->flash->overlay('Overlay Message');
}

/** @test */
public function it_displays_flash_overlay_notifications_with_custom_level()
{
$this->session->shouldReceive('flash')->with('flash_notification.message', 'Overlay Message');
$this->session->shouldReceive('flash')->with('flash_notification.title', 'Notice');
$this->session->shouldReceive('flash')->with('flash_notification.level', 'danger');
$this->session->shouldReceive('flash')->with('flash_notification.overlay', true);

$this->flash->overlay('Overlay Message','Notice','danger');
}

}

0 comments on commit 6031286

Please sign in to comment.