File tree Expand file tree Collapse file tree 2 files changed +28
-25
lines changed Expand file tree Collapse file tree 2 files changed +28
-25
lines changed Original file line number Diff line number Diff line change 1
1
const { getElementType} = require ( '../../lib/utils/get-element-type' )
2
+ const { mockJSXAttribute, mockJSXOpeningElement} = require ( './helpers' )
3
+
2
4
const mocha = require ( 'mocha' )
3
5
const describe = mocha . describe
4
6
const it = mocha . it
5
7
const expect = require ( 'chai' ) . expect
6
8
7
- function mockJSXAttribute ( prop , propValue ) {
8
- return {
9
- type : 'JSXAttribute' ,
10
- name : {
11
- type : 'JSXIdentifier' ,
12
- name : prop ,
13
- } ,
14
- value : {
15
- type : 'Literal' ,
16
- value : propValue ,
17
- } ,
18
- }
19
- }
20
-
21
- function mockJSXOpeningElement ( tagName , attributes = [ ] ) {
22
- return {
23
- type : 'JSXOpeningElement' ,
24
- name : {
25
- type : 'JSXIdentifier' ,
26
- name : tagName ,
27
- } ,
28
- attributes,
29
- }
30
- }
31
-
32
9
function mockSetting ( componentSetting = { } ) {
33
10
return {
34
11
settings : {
Original file line number Diff line number Diff line change
1
+ function mockJSXAttribute ( prop , propValue ) {
2
+ return {
3
+ type : 'JSXAttribute' ,
4
+ name : {
5
+ type : 'JSXIdentifier' ,
6
+ name : prop ,
7
+ } ,
8
+ value : {
9
+ type : 'Literal' ,
10
+ value : propValue ,
11
+ } ,
12
+ }
13
+ }
14
+
15
+ function mockJSXOpeningElement ( tagName , attributes = [ ] ) {
16
+ return {
17
+ type : 'JSXOpeningElement' ,
18
+ name : {
19
+ type : 'JSXIdentifier' ,
20
+ name : tagName ,
21
+ } ,
22
+ attributes,
23
+ }
24
+ }
25
+
26
+ module . exports = { mockJSXAttribute, mockJSXOpeningElement}
You can’t perform that action at this time.
0 commit comments