summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-03-14 10:10:56 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-03-14 10:10:56 -0400
commite90f7afc607a0af326c87ebb184b7eacfee8b92b (patch)
tree30712b447483786217c20367a7f29491305fe2db /tests
parent3b4137c893c21d68a1dbecdcb3acd865dd32057d (diff)
New JavaScript FFI function: setInnerHTML
Diffstat (limited to 'tests')
-rw-r--r--tests/ffi.urs1
-rw-r--r--tests/setInner.js3
-rw-r--r--tests/setInner.ur9
-rw-r--r--tests/setInner.urp7
4 files changed, 20 insertions, 0 deletions
diff --git a/tests/ffi.urs b/tests/ffi.urs
new file mode 100644
index 00000000..f5b719fa
--- /dev/null
+++ b/tests/ffi.urs
@@ -0,0 +1 @@
+val setIt : id -> xbody -> transaction unit
diff --git a/tests/setInner.js b/tests/setInner.js
new file mode 100644
index 00000000..4f71ac26
--- /dev/null
+++ b/tests/setInner.js
@@ -0,0 +1,3 @@
+function setIt(id, html) {
+ setInnerHTML(document.getElementById(id), html);
+}
diff --git a/tests/setInner.ur b/tests/setInner.ur
new file mode 100644
index 00000000..3032f8a7
--- /dev/null
+++ b/tests/setInner.ur
@@ -0,0 +1,9 @@
+fun main () : transaction page =
+ x <- fresh;
+ s <- source 0;
+ q <- source "";
+ return <xml><body>
+ <span id={x}/>
+ <button onclick={v <- get q; set q (v ^ "!"); Ffi.setIt x <xml><dyn signal={n <- signal s; return <xml>n = {[n]}</xml>}/>{[v]}</xml>}/>
+ <button onclick={n <- get s; set s (n + 1)}/>
+ </body></xml>
diff --git a/tests/setInner.urp b/tests/setInner.urp
new file mode 100644
index 00000000..cfbc6a50
--- /dev/null
+++ b/tests/setInner.urp
@@ -0,0 +1,7 @@
+rewrite all SetInner/*
+script http://localhost/setInner.js
+jsFunc Ffi.setIt=setIt
+benignEffectful Ffi.setIt
+ffi ffi
+
+setInner