File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import 'raf/polyfill';
22import { configure } from 'enzyme' ;
33import Adapter from 'enzyme-adapter-react-16' ;
44import ReactDOM from 'react-dom' ;
5+ import { clearInstances } from './src/HelmetData' ;
56
67configure ( { adapter : new Adapter ( ) } ) ;
78
@@ -40,4 +41,5 @@ beforeEach(() => {
4041
4142afterEach ( ( ) => {
4243 ReactDOM . unmountComponentAtNode ( mount ) ;
44+ clearInstances ( ) ;
4345} ) ;
Original file line number Diff line number Diff line change 11import mapStateOnServer from './server' ;
22
3- export default class HelmetData {
4- instances = [ ] ;
3+ const instances = [ ] ;
4+
5+ export function clearInstances ( ) {
6+ instances . length = 0 ;
7+ }
58
9+ export default class HelmetData {
610 value = {
711 setHelmet : serverState => {
812 this . context . helmet = serverState ;
913 } ,
1014 helmetInstances : {
11- get : ( ) => this . instances ,
15+ get : ( ) => instances ,
1216 add : instance => {
13- this . instances . push ( instance ) ;
17+ instances . push ( instance ) ;
1418 } ,
1519 remove : instance => {
16- const index = this . instances . indexOf ( instance ) ;
17- this . instances . splice ( index , 1 ) ;
20+ const index = instances . indexOf ( instance ) ;
21+ instances . splice ( index , 1 ) ;
1822 } ,
1923 } ,
2024 } ;
2125
22- constructor ( context , instances ) {
26+ constructor ( context ) {
2327 this . context = context ;
2428
25- if ( instances ) {
26- this . instances = instances ;
27- }
28-
2929 if ( ! HelmetData . canUseDOM ) {
3030 context . helmet = mapStateOnServer ( {
3131 baseTag : [ ] ,
You can’t perform that action at this time.
0 commit comments