This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-23
lines changed Expand file tree Collapse file tree 2 files changed +2
-23
lines changed Original file line number Diff line number Diff line change @@ -65,19 +65,6 @@ describe('Perf component', function() {
65
65
expect ( this . MockReactAddons . start ) . toHaveBeenCalled ( ) ;
66
66
} ) ;
67
67
68
- it ( 'should not print measurements if none are available' , function ( ) {
69
- const Perf = this . perf ( TestComponent ) ;
70
- this . MockReactAddons . getLastMeasurements . and . returnValue ( [ ] ) ;
71
-
72
- const perf = new Perf ( ) ;
73
- perf . componentDidMount ( ) ;
74
- perf . componentDidUpdate ( ) ;
75
-
76
- expect ( this . MockReactAddons . getLastMeasurements ) . toHaveBeenCalled ( ) ;
77
- expect ( this . MockReactAddons . printWasted ) . not . toHaveBeenCalled ( ) ;
78
- expect ( this . MockConsole . log ) . not . toHaveBeenCalled ( ) ;
79
- } ) ;
80
-
81
68
it ( 'should print measurements if some are available' , function ( ) {
82
69
const Perf = this . perf ( TestComponent ) ;
83
70
this . MockReactAddons . getLastMeasurements . and . returnValue ( [ {
@@ -90,7 +77,6 @@ describe('Perf component', function() {
90
77
91
78
expect ( this . MockReactAddons . getLastMeasurements ) . toHaveBeenCalled ( ) ;
92
79
expect ( this . MockReactAddons . printWasted ) . toHaveBeenCalled ( ) ;
93
- expect ( this . MockConsole . log ) . toHaveBeenCalled ( ) ;
94
80
} ) ;
95
81
} ) ;
96
82
} ) ;
Original file line number Diff line number Diff line change @@ -19,15 +19,8 @@ export default function perf(Component) {
19
19
componentDidUpdate ( ) {
20
20
const measurements = ReactPerf . getLastMeasurements ( ) ;
21
21
22
- if ( measurements . length > 0 ) {
23
- this . totalRenders = ( this . totalRenders || 0 ) + 1 ;
24
- this . totalTime = ( this . totalTime || 0 ) + measurements [ 0 ] . totalTime ;
25
-
26
- console . log ( `Average: ${ this . totalTime / this . totalRenders } over ${ this . totalRenders } renders.` ) ;
27
-
28
- ReactPerf . printWasted ( measurements ) ;
29
- ReactPerf . start ( ) ;
30
- }
22
+ ReactPerf . printWasted ( measurements ) ;
23
+ ReactPerf . start ( ) ;
31
24
}
32
25
render ( ) {
33
26
return < Component { ...this . props } /> ;
You can’t perform that action at this time.
0 commit comments