File tree 9 files changed +81
-22
lines changed
9 files changed +81
-22
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,10 @@ always be in sync.
28
28
29
29
### Development
30
30
31
- - ` script/test ` will fire up a karma runner and watch for changes in the
32
- specs directory .
33
- - ` npm test` will do the same but doesn't watch, just runs the tests.
34
- - ` script/build-examples ` does exactly that.
31
+ - ` npm start ` runs the dev server to run/develop examples
32
+ - ` npm test ` will run the test .
33
+ - ` script/ test` same as ` npm test ` but keeps karma running and watches
34
+ for changes
35
35
36
36
### Build
37
37
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ var App = React.createClass({
27
27
this . setState ( { modalIsOpen : false } ) ;
28
28
} ,
29
29
30
+ handleInputChange : function ( ) {
31
+ this . setState ( { foo : 'bar' } ) ;
32
+ } ,
33
+
30
34
render : function ( ) {
31
35
return (
32
36
< div >
@@ -40,7 +44,7 @@ var App = React.createClass({
40
44
< button onClick = { this . closeModal } > close</ button >
41
45
< div > I am a modal</ div >
42
46
< form >
43
- < input />
47
+ < input onChange = { this . handleInputChange } />
44
48
< input />
45
49
< input />
46
50
< input />
Original file line number Diff line number Diff line change 4
4
< link href ="app.css " rel ="stylesheet "/>
5
5
< body >
6
6
< div id ="example "> </ div >
7
- < script src ="../global-bundle.js "> </ script >
8
- < script src ="app-bundle.js "> </ script >
7
+ < script src ="/__build__/shared.js "> </ script >
8
+ < script src ="/__build__/basic.js "> </ script >
9
+
Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ var Modal = module.exports = React.createClass({
50
50
ariaAppHider . toggle ( props . isOpen , props . appElement ) ;
51
51
}
52
52
sanitizeProps ( props ) ;
53
- this . portal = React . renderComponent ( ModalPortal ( props ) , this . node ) ;
53
+ if ( this . portal )
54
+ this . portal . setProps ( props ) ;
55
+ else
56
+ this . portal = React . renderComponent ( ModalPortal ( props ) , this . node ) ;
54
57
} ,
55
58
56
59
render : function ( ) {
@@ -61,4 +64,3 @@ var Modal = module.exports = React.createClass({
61
64
function sanitizeProps ( props ) {
62
65
delete props . ref ;
63
66
}
64
-
Original file line number Diff line number Diff line change @@ -70,8 +70,10 @@ var ModalPortal = module.exports = React.createClass({
70
70
} ,
71
71
72
72
maybeFocus : function ( ) {
73
- if ( this . props . isOpen )
73
+ if ( this . props . isOpen &&
74
+ ! this . refs . content . getDOMNode ( ) . contains ( document . activeElement ) ) {
74
75
this . focusContent ( ) ;
76
+ }
75
77
} ,
76
78
77
79
focusContent : function ( ) {
@@ -109,7 +111,7 @@ var ModalPortal = module.exports = React.createClass({
109
111
} ,
110
112
111
113
requestClose : function ( ) {
112
- if ( this . ownerHandlesClose )
114
+ if ( this . ownerHandlesClose ( ) )
113
115
this . props . onRequestClose ( ) ;
114
116
} ,
115
117
@@ -152,4 +154,3 @@ var ModalPortal = module.exports = React.createClass({
152
154
) ;
153
155
}
154
156
} ) ;
155
-
Original file line number Diff line number Diff line change 13
13
"example" : " examples"
14
14
},
15
15
"scripts" : {
16
- "test" : " script/test --browsers Firefox --single-run"
16
+ "test" : " script/test --browsers Firefox --single-run" ,
17
+ "start" : " script/dev-examples"
17
18
},
18
19
"authors" : [
19
20
" Ryan Florence"
24
25
"browserify-shim" : " 3.6.0" ,
25
26
"envify" : " 1.2.0" ,
26
27
"expect" : " 0.1.1" ,
28
+ "jsx-loader" : " 0.11.2" ,
27
29
"karma" : " 0.12.16" ,
28
30
"karma-browserify" : " ^0.2.1" ,
29
31
"karma-chrome-launcher" : " 0.1.4" ,
32
34
"karma-mocha" : " 0.1.3" ,
33
35
"mocha" : " 1.20.1" ,
34
36
"react" : " >=0.11.0" ,
35
- "react-tap-event-plugin" : " git://github.com/appsforartists/react-tap-event-plugin" ,
36
37
"reactify" : " ^0.14.0" ,
37
38
"rf-release" : " 0.3.1" ,
38
- "uglify-js" : " 2.4.15"
39
+ "uglify-js" : " 2.4.15" ,
40
+ "webpack-dev-server" : " 1.6.5"
39
41
},
40
42
"peerDependencies" : {
41
43
"react" : " >=0.11.0"
55
57
"browserify-shim" : {
56
58
"react" : " global:React"
57
59
}
58
- }
60
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ node_modules/.bin/webpack-dev-server --inline --content-base examples/
3
+
Original file line number Diff line number Diff line change
1
+ var fs = require ( 'fs' ) ;
2
+ var path = require ( 'path' ) ;
3
+ var webpack = require ( 'webpack' ) ;
4
+
5
+ var EXAMPLES_DIR = path . resolve ( __dirname , 'examples' ) ;
6
+
7
+ function isDirectory ( dir ) {
8
+ return fs . lstatSync ( dir ) . isDirectory ( ) ;
9
+ }
10
+
11
+ function buildEntries ( ) {
12
+ return fs . readdirSync ( EXAMPLES_DIR ) . reduce ( function ( entries , dir ) {
13
+ if ( dir === 'build' )
14
+ return entries ;
15
+
16
+ var isDraft = dir . charAt ( 0 ) === '_' ;
17
+
18
+ if ( ! isDraft && isDirectory ( path . join ( EXAMPLES_DIR , dir ) ) )
19
+ entries [ dir ] = path . join ( EXAMPLES_DIR , dir , 'app.js' ) ;
20
+
21
+ return entries ;
22
+ } , { } ) ;
23
+ }
24
+
25
+ module . exports = {
26
+
27
+ entry : buildEntries ( ) ,
28
+
29
+ output : {
30
+ filename : '[name].js' ,
31
+ chunkFilename : '[id].chunk.js' ,
32
+ path : 'examples/__build__' ,
33
+ publicPath : '/__build__/'
34
+ } ,
35
+
36
+ module : {
37
+ loaders : [
38
+ { test : / \. j s $ / , loader : 'jsx-loader?harmony' }
39
+ ]
40
+ } ,
41
+
42
+ resolve : {
43
+ alias : {
44
+ 'react-router' : '../../modules/index'
45
+ }
46
+ } ,
47
+
48
+ plugins : [
49
+ new webpack . optimize . CommonsChunkPlugin ( 'shared.js' )
50
+ ]
51
+
52
+ } ;
You can’t perform that action at this time.
0 commit comments