File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
route_based_notifier/__tests__ Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ describe('Notifier', function () {
33
33
34
34
beforeEach ( function ( ) {
35
35
params = { location : 'foo' } ;
36
- while ( Notifier . prototype . _notifs . pop ( ) ) ; // clear global notifications
37
36
notifier = new Notifier ( params ) ;
38
37
} ) ;
39
38
39
+ afterEach ( function ( ) {
40
+ Notifier . prototype . _notifs . length = 0 ;
41
+ } ) ;
42
+
40
43
describe ( '#constructor()' , function ( ) {
41
44
it ( 'sets #from from given location' , function ( ) {
42
45
expect ( notifier . from ) . to . equal ( params . location ) ;
@@ -465,13 +468,12 @@ describe('Directive Notification', function () {
465
468
scope ;
466
469
} ) ;
467
470
468
- while ( Notifier . prototype . _notifs . pop ( ) ) ; // clear global notifications
469
-
470
471
notifier = new Notifier ( { location : 'directiveFoo' } ) ;
471
472
directiveNotification = notifier . directive ( directiveParam , customParams ) ;
472
473
} ) ;
473
474
474
475
afterEach ( ( ) => {
476
+ Notifier . prototype . _notifs . length = 0 ;
475
477
directiveNotification . clear ( ) ;
476
478
scope . $destroy ( ) ;
477
479
} ) ;
Original file line number Diff line number Diff line change @@ -10,12 +10,15 @@ describe('ui/route_based_notifier', function () {
10
10
11
11
beforeEach ( ngMock . module ( 'kibana' ) ) ;
12
12
beforeEach ( ngMock . inject ( ( $injector ) => {
13
- remove ( Notifier . prototype . _notifs ) ; // hack to reset the global notification array
14
13
const Private = $injector . get ( 'Private' ) ;
15
14
routeBasedNotifier = Private ( routeBasedNotifierProvider ) ;
16
15
$rootScope = $injector . get ( '$rootScope' ) ;
17
16
} ) ) ;
18
17
18
+ afterEach ( ( ) => {
19
+ Notifier . prototype . _notifs . length = 0 ;
20
+ } ) ;
21
+
19
22
describe ( '#warning()' , ( ) => {
20
23
it ( 'adds a warning notification' , ( ) => {
21
24
routeBasedNotifier . warning ( 'wat' ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import chrome from 'ui/chrome';
6
6
import Nonsense from 'Nonsense' ;
7
7
import sinon from 'sinon' ;
8
8
import _ from 'lodash' ;
9
+ import Notifier from 'ui/notify/notifier' ;
9
10
10
11
import StackTraceMapper from 'ui/stack_trace_mapper' ;
11
12
import { parse } from 'url' ;
@@ -55,6 +56,13 @@ before(function () {
55
56
sinon . useFakeXMLHttpRequest ( ) ;
56
57
} ) ;
57
58
59
+ beforeEach ( function ( ) {
60
+ if ( Notifier . prototype . _notifs . length ) {
61
+ Notifier . prototype . _notifs . length = 0 ;
62
+ throw new TypeError ( 'notifications were left in the notifier' ) ;
63
+ }
64
+ } ) ;
65
+
58
66
59
67
/*** Kick off mocha, called at the end of test entry files ***/
60
68
exports . bootstrap = function ( ) {
You can’t perform that action at this time.
0 commit comments