Commit 7c902e5eeba97210608954a208470276224e68e5

Authored by jim
1 parent 45bef6f3

Modify harmony example to cover more code paths.

Showing 1 changed file with 43 additions and 3 deletions   Show diff stats
examples/basic-jsx-harmony/index.html
... ... @@ -28,22 +28,62 @@
28 28 <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
29 29 <script type="text/babel">
30 30 class ExampleApplication extends React.Component {
  31 + constructor()
  32 + {
  33 + super();
  34 + this.state = {value: ''};
  35 + }
  36 +
31 37 render() {
32 38 var elapsed = Math.round(this.props.elapsed / 100);
33 39 var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
34 40 var message =
35 41 `React has been successfully running for ${seconds} seconds.`;
36 42  
37   - return <p>{message}</p>;
  43 + return <div>{message}<input type="text" value={this.state.value} onChange={(e)=>this.setState({value: e.target.value})} />{Math.random() > 0.5 ? <div>random<div /></div> : null}</div>;
38 44 }
39 45 }
40 46 var start = new Date().getTime();
41   - setInterval(() => {
  47 +
  48 + ReactDOM.render(
  49 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  50 + document.getElementById('container')
  51 + );
  52 +
  53 + ReactDOM.render(
  54 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  55 + document.getElementById('container')
  56 + );
  57 +
  58 + ReactDOM.render(
  59 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  60 + document.getElementById('container')
  61 + );
  62 +
  63 + ReactDOM.render(
  64 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  65 + document.getElementById('container')
  66 + );
  67 +
  68 + ReactDOM.render(
  69 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  70 + document.getElementById('container')
  71 + );
  72 +
  73 + ReactDOM.render(
  74 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  75 + document.getElementById('container')
  76 + );
  77 +
  78 + ReactDOM.render(
  79 + <ExampleApplication elapsed={new Date().getTime() - start} />,
  80 + document.getElementById('container')
  81 + );
  82 +
42 83 ReactDOM.render(
43 84 <ExampleApplication elapsed={new Date().getTime() - start} />,
44 85 document.getElementById('container')
45 86 );
46   - }, 50);
47 87 </script>
48 88 </body>
49 89 </html>
... ...