File tree Expand file tree Collapse file tree 9 files changed +491
-14
lines changed Expand file tree Collapse file tree 9 files changed +491
-14
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ yarn-error.log*
44package-lock.json
55dist
66.DS_Store
7+ coverage
Original file line number Diff line number Diff line change 3232 ]
3333 },
3434 "lint-staged" : {
35- "*.{js}" : [
35+ "**/* .{js}" : [
3636 " flow focus-check" ,
3737 " prettier --write" ,
3838 " git add"
3939 ],
40- "*.{json,md}" : [
40+ "**/* .{json,md}" : [
4141 " prettier --write" ,
4242 " git add"
4343 ]
Original file line number Diff line number Diff line change 1+ import * as is from 'react-is'
2+ import { typeOf } from '../element'
3+
4+ import {
5+ REACT_ELEMENT_TYPE ,
6+ REACT_PORTAL_TYPE ,
7+ REACT_FRAGMENT_TYPE ,
8+ REACT_STRICT_MODE_TYPE ,
9+ REACT_PROFILER_TYPE ,
10+ REACT_PROVIDER_TYPE ,
11+ REACT_CONTEXT_TYPE ,
12+ REACT_CONCURRENT_MODE_TYPE ,
13+ REACT_FORWARD_REF_TYPE ,
14+ REACT_SUSPENSE_TYPE ,
15+ REACT_MEMO_TYPE ,
16+ REACT_LAZY_TYPE
17+ } from '../symbols'
18+
19+ describe ( 'typeOf' , ( ) => {
20+ it ( 'correctly identifies all elements' , ( ) => {
21+ expect ( typeOf ( { } ) ) . toBe ( undefined )
22+
23+ expect ( typeOf ( {
24+ $$typeof : is . Portal
25+ } ) ) . toBe ( REACT_PORTAL_TYPE )
26+
27+ expect ( typeOf ( {
28+ $$typeof : is . Element ,
29+ type : is . ConcurrentMode
30+ } ) ) . toBe ( REACT_CONCURRENT_MODE_TYPE )
31+
32+ expect ( typeOf ( {
33+ $$typeof : is . Element ,
34+ type : is . Fragment
35+ } ) ) . toBe ( REACT_FRAGMENT_TYPE )
36+
37+ expect ( typeOf ( {
38+ $$typeof : is . Element ,
39+ type : is . Profiler
40+ } ) ) . toBe ( REACT_PROFILER_TYPE )
41+
42+ expect ( typeOf ( {
43+ $$typeof : is . Element ,
44+ type : is . StrictMode
45+ } ) ) . toBe ( REACT_STRICT_MODE_TYPE )
46+
47+ expect ( typeOf ( {
48+ $$typeof : is . Element ,
49+ type : is . Suspense
50+ } ) ) . toBe ( REACT_SUSPENSE_TYPE )
51+ } )
52+ } )
Original file line number Diff line number Diff line change 1+ import * as is from 'react-is'
2+ import { typeOf } from '../element'
3+
4+ import {
5+ REACT_ELEMENT_TYPE ,
6+ REACT_PORTAL_TYPE ,
7+ REACT_FRAGMENT_TYPE ,
8+ REACT_STRICT_MODE_TYPE ,
9+ REACT_PROFILER_TYPE ,
10+ REACT_PROVIDER_TYPE ,
11+ REACT_CONTEXT_TYPE ,
12+ REACT_CONCURRENT_MODE_TYPE ,
13+ REACT_FORWARD_REF_TYPE ,
14+ REACT_SUSPENSE_TYPE ,
15+ REACT_MEMO_TYPE ,
16+ REACT_LAZY_TYPE
17+ } from '../symbols'
18+
19+ describe ( 'typeOf' , ( ) => {
20+ it ( 'correctly identifies all elements' , ( ) => {
21+ expect ( typeOf ( { } ) ) . toBe ( undefined )
22+
23+ expect ( typeOf ( {
24+ $$typeof : is . Portal
25+ } ) ) . toBe ( REACT_PORTAL_TYPE )
26+
27+ expect ( typeOf ( {
28+ $$typeof : is . Element ,
29+ type : is . ConcurrentMode
30+ } ) ) . toBe ( REACT_CONCURRENT_MODE_TYPE )
31+
32+ expect ( typeOf ( {
33+ $$typeof : is . Element ,
34+ type : is . Fragment
35+ } ) ) . toBe ( REACT_FRAGMENT_TYPE )
36+
37+ expect ( typeOf ( {
38+ $$typeof : is . Element ,
39+ type : is . Profiler
40+ } ) ) . toBe ( REACT_PROFILER_TYPE )
41+
42+ expect ( typeOf ( {
43+ $$typeof : is . Element ,
44+ type : is . StrictMode
45+ } ) ) . toBe ( REACT_STRICT_MODE_TYPE )
46+ } )
47+ } )
You can’t perform that action at this time.
0 commit comments