@@ -23,59 +23,6 @@ function runAllTests(useWeakMap) {
23
23
expect ( < A1 /> . type ) . toBe ( A1 )
24
24
} )
25
25
26
- it . skip ( 'ignores late registrations' , ( ) => {
27
- function Kanye ( ) { }
28
- function Kanye2 ( ) { }
29
-
30
- React . createElement ( Kanye )
31
-
32
- // By this time we have to assume the user might have rendered it.
33
- // It's unsafe to resolve it to a different type afterwards,
34
- // or we may cause an existing component to unmount unpredictably.
35
- // https://github.com/gaearon/react-hot-loader/issues/241
36
-
37
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
38
- try {
39
- RHL . register ( Kanye , 'Yeezy' , '/wow/test.js' )
40
- expect ( console . error . mock . calls . length ) . toBe ( 1 )
41
- expect ( console . error . mock . calls [ 0 ] [ 0 ] ) . toBe (
42
- 'React Hot Loader: Yeezy in /wow/test.js will not hot reload ' +
43
- 'correctly because test.js uses <Yeezy /> during ' +
44
- 'module definition. For hot reloading to work, move Yeezy ' +
45
- 'into a separate file and import it from test.js.' ,
46
- )
47
- expect ( < Kanye /> . type ) . toBe ( Kanye )
48
- expect ( < Kanye2 /> . type ) . toBe ( Kanye2 )
49
-
50
- RHL . register ( Kanye2 , 'Yeezy' , '/wow/test.js' )
51
- expect ( console . error . mock . calls . length ) . toBe ( 1 )
52
- expect ( < Kanye /> . type ) . toBe ( Kanye )
53
- expect ( < Kanye2 /> . type ) . toBe ( Kanye2 )
54
- } finally {
55
- spy . mockRestore ( )
56
- }
57
- } )
58
-
59
- it . skip ( 'report proxy duplicates' , ( ) => {
60
- const createUniqueComponent = variable => ( ) => < div > 123{ variable } </ div >
61
- const f1 = createUniqueComponent ( 1 )
62
- const f2 = createUniqueComponent ( 2 )
63
-
64
- const spy = jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
65
-
66
- try {
67
- RHL . register ( createUniqueComponent , 'f1' , '/wow/test.js' )
68
- React . createElement ( f1 )
69
- React . createElement ( f1 )
70
- expect ( console . warn . mock . calls . length ) . toBe ( 0 )
71
- RHL . register ( createUniqueComponent , 'f1' , '/wow/test.js' )
72
- React . createElement ( f2 )
73
- expect ( console . warn . mock . calls . length ) . toBe ( 1 )
74
- } finally {
75
- spy . mockRestore ( )
76
- }
77
- } )
78
-
79
26
it ( 'report proxy named duplicates' , ( ) => {
80
27
const createUniqueComponent = variable => ( ) => < div > 123{ variable } </ div >
81
28
const f1 = createUniqueComponent ( 1 )
@@ -97,53 +44,6 @@ function runAllTests(useWeakMap) {
97
44
}
98
45
} )
99
46
100
- it . skip ( 'report proxy failures' , ( ) => {
101
- const f1 = ( ) => < div > 234</ div >
102
- const f2 = ( ) => < div > 123</ div >
103
- const f3 = ( ) => < div > 123</ div >
104
- const f4 = ( ) => < div > 123</ div >
105
-
106
- const dynamic = ( ) => ( ) => < div > 123</ div >
107
-
108
- const spy = jest . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } )
109
-
110
- try {
111
- RHL . register ( f1 , 'f1' , '/wow/test.js' )
112
-
113
- // emulate `static` components from node_modules
114
- React . createElement ( f1 )
115
- React . createElement ( f1 )
116
- expect ( console . warn . mock . calls . length ) . toBe ( 0 )
117
- React . createElement ( f2 )
118
- React . createElement ( f2 )
119
- React . createElement ( f3 )
120
- React . createElement ( f3 )
121
-
122
- expect ( console . warn . mock . calls . length ) . toBe ( 0 )
123
-
124
- // emulate uncatched non-static component
125
- React . createElement ( dynamic ( ) )
126
- expect ( console . warn . mock . calls . length ) . toBe ( 0 )
127
- React . createElement ( dynamic ( ) )
128
- expect ( console . warn . mock . calls . length ) . toBe ( 0 )
129
-
130
- // emulate HMR
131
- RHL . register ( f4 , 'f1' , '/wow/test.js' )
132
-
133
- const signature = dynamic ( )
134
- React . createElement ( signature )
135
- expect ( console . warn . mock . calls . length ) . toBe ( 1 )
136
- expect ( console . warn . mock . calls [ 0 ] [ 0 ] ) . toBe (
137
- 'React Hot Loader: this component is not accepted by Hot Loader. \n' +
138
- 'Please check is it extracted as a top level class, a function or a variable. \n' +
139
- 'Click below to reveal the source location: \n' ,
140
- )
141
- expect ( console . warn . mock . calls [ 0 ] [ 1 ] ) . toBe ( signature )
142
- } finally {
143
- spy . mockRestore ( )
144
- }
145
- } )
146
-
147
47
it ( 'resolves registered types by their last ID' , ( ) => {
148
48
RHL . register ( A1 , 'a' , 'test.js' )
149
49
const A = < A1 /> . type
0 commit comments