File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed
@plotly/dash-test-components/src
tests/integration/renderer Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ import PropTypes from "prop-types" ;
3
+
4
+ const AddPropsComponent = ( props ) => {
5
+ const { children, id} = props ;
6
+
7
+
8
+ return (
9
+ < div id = { id } >
10
+ { React . cloneElement ( children , {
11
+ receive : `Element #${ id } pass` ,
12
+ id : id ,
13
+ } ) }
14
+ </ div >
15
+ ) ;
16
+ } ;
17
+
18
+ AddPropsComponent . propTypes = {
19
+ id : PropTypes . string ,
20
+ children : PropTypes . node ,
21
+ } ;
22
+
23
+ export default AddPropsComponent ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+
4
+ const ReceivePropsComponent = ( props ) => {
5
+ const { id, text, receive} = props ;
6
+
7
+ return (
8
+ < div id = { id } >
9
+ { receive || text }
10
+ </ div >
11
+ ) ;
12
+ }
13
+ ReceivePropsComponent . propTypes = {
14
+ id : PropTypes . string ,
15
+ text : PropTypes . string ,
16
+ receive : PropTypes . string ,
17
+ }
18
+
19
+ export default ReceivePropsComponent ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import MyPersistedComponentNested from './components/MyPersistedComponentNested'
7
7
import StyledComponent from './components/StyledComponent' ;
8
8
import WidthComponent from './components/WidthComponent' ;
9
9
import ComponentAsProp from './components/ComponentAsProp' ;
10
+ import AddPropsComponent from "./components/AddPropsComponent" ;
11
+ import ReceivePropsComponent from "./components/ReceivePropsComponent" ;
10
12
11
13
export {
12
14
AsyncComponent ,
@@ -18,4 +20,6 @@ export {
18
20
StyledComponent ,
19
21
WidthComponent ,
20
22
ComponentAsProp ,
23
+ AddPropsComponent ,
24
+ ReceivePropsComponent
21
25
} ;
Original file line number Diff line number Diff line change
1
+ from dash import Dash , html
2
+
3
+ from dash_test_components import AddPropsComponent , ReceivePropsComponent
4
+
5
+
6
+ def test_dvui001_add_receive_props (dash_duo ):
7
+ app = Dash (__name__ )
8
+ app .layout = html .Div (
9
+ [
10
+ AddPropsComponent (
11
+ ReceivePropsComponent (
12
+ id = 'test-receive1' ,
13
+ text = 'receive component1' ,
14
+ ),
15
+ id = 'test-add'
16
+ ),
17
+ ReceivePropsComponent (
18
+ id = 'test-receive2' ,
19
+ text = 'receive component2' ,
20
+ ),
21
+ ]
22
+ )
23
+
24
+ dash_duo .start_server (
25
+ app ,
26
+ debug = True ,
27
+ use_reloader = False ,
28
+ use_debugger = True ,
29
+ dev_tools_hot_reload = False ,
30
+ dev_tools_props_check = False ,
31
+ )
You can’t perform that action at this time.
0 commit comments