|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"><head> |
| 3 | +<title>ui-test.js test</title> |
| 4 | +<meta name="viewport" content="initial-scale=1,maximum-scale=1"> |
| 5 | +<link rel="icon" href="data:image/x-icon;,"> |
| 6 | +<style> |
| 7 | +*, *:before, *:after { box-sizing: inherit } |
| 8 | +html { box-sizing: border-box; background: #eee } |
| 9 | +body { margin: 0 auto; max-width: 600px; padding: 18px; font: 18px/1.5 sans-serif } |
| 10 | +nav > a { margin-right: 16px } |
| 11 | +nav > a.is-sel { font-weight: bold } |
| 12 | +.count { font-size: 24px } |
| 13 | +</style> |
| 14 | +</head><body> |
| 15 | +<pre id=out></pre> |
| 16 | +<script type="ui"> |
| 17 | + |
| 18 | +%js |
| 19 | + El.$d.count = 0 |
| 20 | + El.$d.inc = function() { El.$d.count++; El.render(document.body) } |
| 21 | + |
| 22 | +%view #layout # |
| 23 | + header |
| 24 | + h1 Test App |
| 25 | + nav |
| 26 | + %el nav-link |
| 27 | + a ;cls "is-sel",url==($el.href.split("#")[1]||"home") |
| 28 | + nav-link[href="#"] Home |
| 29 | + nav-link[href="#about"] About |
| 30 | + nav-link[href="#counter"] Counter |
| 31 | + hr |
| 32 | + %slot |
| 33 | + footer |
| 34 | + hr |
| 35 | + p.info ;txt "Current: "+url |
| 36 | + |
| 37 | +%view home #layout |
| 38 | +main |
| 39 | + h2 Welcome |
| 40 | + p This is the home page. |
| 41 | + |
| 42 | +%view about #layout |
| 43 | +main |
| 44 | + h2 About |
| 45 | + p This is the about page. |
| 46 | + ul |
| 47 | + li Item A |
| 48 | + li Item B |
| 49 | + li Item C |
| 50 | + |
| 51 | +%view counter #layout |
| 52 | +main |
| 53 | + h2 Counter |
| 54 | + p.count ;txt "Count: "+count |
| 55 | + button#btn-inc ;on "click",inc |
| 56 | + | Increment |
| 57 | + |
| 58 | +%start |
| 59 | + |
| 60 | +</script> |
| 61 | +<script src="https://litejs.com/litejs.full.min.js"></script> |
| 62 | +<script src="../test.js"></script> |
| 63 | +<script src="../ui-test.js"></script> |
| 64 | +<script> |
| 65 | +describe.onend = function() { |
| 66 | + out.textContent = describe.output |
| 67 | +} |
| 68 | +</script> |
| 69 | +<script src="ui-test.js"></script> |
| 70 | +<noscript>This application requires JavaScript</noscript> |
| 71 | +</body></html> |
0 commit comments