summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cradio.py27
-rw-r--r--tests/cradio.ur13
-rw-r--r--tests/cradio.urp3
-rw-r--r--tests/cradio.urs1
4 files changed, 44 insertions, 0 deletions
diff --git a/tests/cradio.py b/tests/cradio.py
new file mode 100644
index 00000000..b70b2ef1
--- /dev/null
+++ b/tests/cradio.py
@@ -0,0 +1,27 @@
+import unittest
+import base
+
+# issue: initialization doesn't quite work
+
+class Suite(base.Base):
+# test case:
+# initially the source is EMPTY
+# then we pick SECOND variant and check the source
+# then we pick the FIRST variant and check the source
+ def test_1(self):
+ """Test case 1"""
+ self.start("Cradio/main")
+ txt = self.body_text()
+ self.assertEqual("Wilbur Walbur Hello, I'm B. I'll be your waiter for this evening.", txt)
+ el1 = self.xpath('label[1]/input')
+ el2 = self.xpath('label[2]/input')
+ self.assertEqual(False, el1.is_selected())
+ self.assertEqual(True, el2.is_selected())
+ el1.click()
+ alert = self.driver.switch_to.alert
+ self.assertEqual("Now it's A", alert.text)
+ alert.accept()
+ self.assertEqual(True, el1.is_selected())
+ self.assertEqual(False, el2.is_selected())
+ txt = self.body_text()
+ self.assertEqual("Wilbur Walbur Hello, I'm A. I'll be your waiter for this evening.", txt)
diff --git a/tests/cradio.ur b/tests/cradio.ur
new file mode 100644
index 00000000..5b6e9d22
--- /dev/null
+++ b/tests/cradio.ur
@@ -0,0 +1,13 @@
+fun main () =
+s <- source (Some "B");
+let
+ val onc = v <- get s; alert ("Now it's " ^ show v)
+in
+ return <xml><body>
+ <label>Wilbur <cradio source={s} value="A" onchange={onc}/></label>
+ <label>Walbur <cradio source={s} value="B" onchange={onc}/></label>
+
+ Hello, I'm <dyn signal={s <- signal s; return <xml>{[s]}</xml>}/>.
+ I'll be your waiter for this evening.
+ </body></xml>
+end
diff --git a/tests/cradio.urp b/tests/cradio.urp
new file mode 100644
index 00000000..0681ab21
--- /dev/null
+++ b/tests/cradio.urp
@@ -0,0 +1,3 @@
+debug
+
+cradio
diff --git a/tests/cradio.urs b/tests/cradio.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/cradio.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page