(module delirium mzscheme
(require (lib "contract.ss")
(lib "etc.ss")
(lib "cut.ss" "srfi" "26")
(lib "servlet.ss" "web-server"))
(require (file "base.ss")
(file "accessor.ss")
(file "command.ss")
(file "core.ss")
(file "selector.ss"))
(define run-delirium
(opt-lambda (request test [run-tests test/text-ui/pause-on-fail])
(send-test-page)
(test/delirium request test run-tests)))
(define (send-test-page)
(send/suspend/dispatch
(lambda (embed-url)
(make-response/full
200
"Okay"
(current-milliseconds)
#"text/html"
null
(list #<<ENDHTML
<html>
<head>
<script type="text/javascript" src="/scripts/delirium/lib/prototype/prototype.js"></script>
<script type="text/javascript" src="/scripts/delirium/core/delirium.js"></script>
<script type="text/javascript" src="/scripts/delirium/core/map.js"></script>
<script type="text/javascript" src="/scripts/delirium/core/protocol.js"></script>
<script type="text/javascript" src="/scripts/delirium/core/accessor.js"></script>
<script type="text/javascript" src="/scripts/delirium/core/command.js"></script>
<script type="text/javascript" src="/scripts/delirium/core/selector.js"></script>
<script type="text/javascript">
// <![CDATA[
ENDHTML
(js (ignore ((dot Event observe)
window
"load"
(lambda ()
(ignore ((dot Delirium start)
"target"
,(embed-url (lambda (request) request))))))))
#<<ENDHTML
// ]]>
</script>
<style type="text/css">
body { background: #ccc url(/images/delirium/background.png) repeat-x fixed top left margin: 0pxtable { border: nonetr#targetrow td { border: nonetr#titlerow { height: 1emtr#titlerow th { font-weight: normaliframe { background: #fff</style>
</head>
<body>
<table width="100%" height="100%">
<tbody>
<tr id="targetrow"><td>
<iframe id="target" width="100%" height="100%"></iframe>
</td></tr>
<tr id="titlerow"><th id="title">
Delirium by <a href="http://www.untyped.com">Untyped</a>
</th></tr>
</tbody>
</table>
</body>
</html>
ENDHTML
)))))
(provide (all-from (file "accessor.ss"))
(all-from (file "command.ss"))
(all-from (file "selector.ss")))
(provide schemeunit-test?
javascript-expression?
javascript-statement?
test/text-ui/pause-on-fail)
(provide/contract
[run-delirium (opt-> (request? schemeunit-test?)
(procedure?)
response?)])
)