Skip to content

Commit

Permalink
Avoid creating empty flashes. (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarce authored and RoopeHakulinen committed Oct 25, 2016
1 parent 84a549d commit a07c264
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/angular-flash.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! angular-flash - v2.3.0 - 2016-04-24
/*! angular-flash - v2.3.0 - 2016-08-23
* https://github.com/sachinchoolur/angular-flash
* Copyright (c) 2016 Sachin; Licensed MIT */

Expand Down
3 changes: 2 additions & 1 deletion dist/angular-flash.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-flash.js.map

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions dist/angular-flash.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/angular-flash.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-flash.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/angular-flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ app.provider('Flash', function() {
dataFactory.config = defaultConfig;

dataFactory.create = function(type, text, timeout, config, showClose) {
if (!text) return false;
let $this, flash;
$this = this;
flash = {
Expand Down
8 changes: 8 additions & 0 deletions test/angular-flash_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ describe('Unit testing Angular Flash', function() {
expect(contents[0].nodeType).toEqual(Node.ELEMENT_NODE);
});

it('avoid to display flash when it does not have content', function() {
created = Flash.create('success', '');
$rootScope.$digest();
var contents = node.contents()[0];
expect(contents.querySelectorAll('.alert').length).toEqual(0);
expect(created).toEqual(false);
});

it('has the class specified', function() {
var testClassName = 'test-class';
Flash.create('success', 'Good job', 10000, {class: testClassName});
Expand Down

0 comments on commit a07c264

Please sign in to comment.