@@ -28,6 +28,7 @@ describe('editing interface', () => {
28
28
bridge = global . bridge ;
29
29
store = global . store ;
30
30
store . collapseNodesByDefault = false ;
31
+ store . componentFilters = [ ] ;
31
32
32
33
PropTypes = require ( 'prop-types' ) ;
33
34
React = require ( 'react' ) ;
@@ -37,8 +38,10 @@ describe('editing interface', () => {
37
38
describe ( 'props' , ( ) => {
38
39
let committedClassProps ;
39
40
let committedFunctionProps ;
41
+ let inputRef ;
40
42
let classID ;
41
43
let functionID ;
44
+ let hostComponentID ;
42
45
43
46
async function mountTestApp ( ) {
44
47
class ClassComponent extends React . Component {
@@ -60,6 +63,8 @@ describe('editing interface', () => {
60
63
return null ;
61
64
}
62
65
66
+ inputRef = React . createRef ( null ) ;
67
+
63
68
const container = document . createElement ( 'div' ) ;
64
69
await utils . actAsync ( ( ) =>
65
70
ReactDOM . render (
@@ -76,13 +81,15 @@ describe('editing interface', () => {
76
81
shallow = "initial"
77
82
/>
78
83
,
84
+ < input ref = { inputRef } onChange = { jest . fn ( ) } value = "initial" />
79
85
</ > ,
80
86
container ,
81
87
) ,
82
88
) ;
83
89
84
90
classID = ( ( store . getElementIDAtIndex ( 0 ) : any ) : number ) ;
85
91
functionID = ( ( store . getElementIDAtIndex ( 1 ) : any ) : number ) ;
92
+ hostComponentID = ( ( store . getElementIDAtIndex ( 2 ) : any ) : number ) ;
86
93
87
94
expect ( committedClassProps ) . toStrictEqual ( {
88
95
array : [ 1 , 2 , 3 ] ,
@@ -98,6 +105,7 @@ describe('editing interface', () => {
98
105
} ,
99
106
shallow : 'initial' ,
100
107
} ) ;
108
+ expect ( inputRef . current . value ) . toBe ( 'initial' ) ;
101
109
}
102
110
103
111
it ( 'should have editable values' , async ( ) => {
@@ -380,6 +388,25 @@ describe('editing interface', () => {
380
388
object : { } ,
381
389
} ) ;
382
390
} ) ;
391
+
392
+ it ( 'should support editing host component values' , async ( ) => {
393
+ await mountTestApp ( ) ;
394
+
395
+ function overrideProps ( id , path , value ) {
396
+ const rendererID = utils . getRendererID ( ) ;
397
+ bridge . send ( 'overrideValueAtPath' , {
398
+ id,
399
+ path,
400
+ rendererID,
401
+ type : 'props' ,
402
+ value,
403
+ } ) ;
404
+ flushPendingUpdates ( ) ;
405
+ }
406
+
407
+ overrideProps ( hostComponentID , [ 'value' ] , 'updated' ) ;
408
+ expect ( inputRef . current . value ) . toBe ( 'updated' ) ;
409
+ } ) ;
383
410
} ) ;
384
411
385
412
describe ( 'state' , ( ) => {
0 commit comments