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 11const { getElementType} = require ( '../../lib/utils/get-element-type' )
2+ const { mockJSXAttribute, mockJSXOpeningElement} = require ( './helpers' )
3+
24const mocha = require ( 'mocha' )
35const describe = mocha . describe
46const it = mocha . it
57const expect = require ( 'chai' ) . expect
68
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-
329function mockSetting ( componentSetting = { } ) {
3310 return {
3411 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