File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ import assert from 'power-assert' ;
2
+ import sinon from 'sinon' ;
3
+ import reducer from '../../src/reducer' ;
4
+ import * as actions from '../../src/actions' ;
5
+
6
+ describe ( 'reducer' , ( ) => {
7
+ let warn ;
8
+ beforeEach ( ( ) => {
9
+ warn = sinon . spy ( console , 'warn' ) ;
10
+ } ) ;
11
+
12
+ afterEach ( ( ) => {
13
+ console . warn . restore ( ) ;
14
+ } ) ;
15
+
16
+ it ( "warns with 'el' prop" , ( ) => {
17
+ reducer ( undefined , actions . show ( { el : 'abc' } ) ) ;
18
+ assert ( warn . calledOnce ) ;
19
+ assert ( warn . firstCall . args [ 0 ] === "DEPRECATED: Use 'origin' instead of 'el' in props for Tooltip component or 'show' action." ) ;
20
+ } ) ;
21
+
22
+ it ( "doesn't warn with 'origin' prop" , ( ) => {
23
+ reducer ( undefined , actions . show ( { origin : 'abc' } ) ) ;
24
+ assert ( warn . callCount === 0 ) ;
25
+ } ) ;
26
+
27
+ it ( "ignores non-related actions which contains 'el' prop in payload" , ( ) => {
28
+ reducer ( undefined , { type : 'NON_RELATED_ACTION' , payload : { el : 'abc' } } ) ;
29
+ assert ( warn . callCount === 0 ) ;
30
+ } ) ;
31
+ } ) ;
You can’t perform that action at this time.
0 commit comments