File tree Expand file tree Collapse file tree 2 files changed +38
-3
lines changed
Expand file tree Collapse file tree 2 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 44 "description" : " Yosh presents: Choo x React" ,
55 "main" : " index.js" ,
66 "scripts" : {
7- "deps" : " dependency-check . && dependency-check . --extra --no-dev" ,
7+ "deps" : " dependency-check . html.js && dependency-check . html.js --extra --no-dev" ,
88 "test" : " standard && npm run deps && NODE_ENV=test node test" ,
99 "test:cov" : " standard && npm run deps && NODE_ENV=test istanbul cover test.js"
1010 },
2525 "nanoraf" : " ^2.1.1" ,
2626 "preact" : " ^7.1.0" ,
2727 "sheet-router" : " 4.0.0-0" ,
28- "xtend" : " ^4.0.1" ,
29- "yo-yo" : " ^1.2.2"
28+ "xtend" : " ^4.0.1"
3029 },
3130 "devDependencies" : {
3231 "bankai" : " ^3.2.0" ,
3332 "dependency-check" : " ^2.6.0" ,
3433 "istanbul" : " ^0.4.5" ,
34+ "jsdom" : " ^9.9.1" ,
35+ "jsdom-global" : " ^2.1.1" ,
3536 "standard" : " ^8.0.0" ,
3637 "tape" : " ^4.6.0"
3738 }
Original file line number Diff line number Diff line change 1+ require ( 'jsdom-global' ) ( '' , { url : 'http://localhost:8080/' } )
2+ global . SVGElement = global . Element
3+
4+ const test = require ( 'tape' )
5+ const html = require ( '../html' )
6+ const rooch = require ( '../' )
7+
8+ test ( 'basic rendering' , t => {
9+ t . plan ( 1 )
10+
11+ const app = rooch ( )
12+
13+ app . model ( {
14+ state : { title : 'Not quite set yet' } ,
15+ reducers : {
16+ update : ( data , state ) => ( { title : data } )
17+ }
18+ } )
19+
20+ app . router ( [ '/' , ( state , prev , send ) => {
21+ return html `
22+ < main >
23+ < h1 > Title: ${ state . title } </ h1 >
24+ < input
25+ type ="text "
26+ oninput =${ ( e ) => send ( 'update' , e . target . value ) } >
27+ </ main >
28+ `
29+ } ] )
30+
31+ app ( document . body )
32+
33+ t . equal ( document . body . innerHTML , `<main>\n <h1>Title: Not quite set yet</h1>\n <input type="text">\n </main>` )
34+ } )
You can’t perform that action at this time.
0 commit comments