summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cradio.py20
-rw-r--r--tests/cradio.ur17
-rwxr-xr-xtests/driver.sh2
3 files changed, 32 insertions, 7 deletions
diff --git a/tests/cradio.py b/tests/cradio.py
index acc8dc11..cc075593 100644
--- a/tests/cradio.py
+++ b/tests/cradio.py
@@ -5,8 +5,10 @@ class Suite(base.Base):
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)
+ txt = self.xpath('div[1]').text
+ self.assertEqual("Hello, I'm B. I'll be your waiter for this evening.", txt)
+ txt2 = self.xpath('div[2]').text
+ self.assertEqual('Value:', txt2)
el1 = self.xpath('label[1]/input')
el2 = self.xpath('label[2]/input')
self.assertEqual(False, el1.is_selected())
@@ -17,5 +19,15 @@ class Suite(base.Base):
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)
+ txt = self.xpath('div[1]').text
+ self.assertEqual("Hello, I'm A. I'll be your waiter for this evening.", txt)
+ txt2 = self.xpath('div[2]').text
+ self.assertEqual('Value:', txt2)
+ # now check that the second radio group works as well
+ el3 = self.xpath('label[4]/input')
+ el3.click()
+ alert = self.driver.switch_to.alert
+ alert.accept()
+ txt2 = self.xpath('div[2]').text
+ self.assertEqual('Value: Y', txt2)
+ self.assertEqual("Hello, I'm A. I'll be your waiter for this evening.", txt)
diff --git a/tests/cradio.ur b/tests/cradio.ur
index 5b6e9d22..48c04f1e 100644
--- a/tests/cradio.ur
+++ b/tests/cradio.ur
@@ -1,13 +1,26 @@
fun main () =
s <- source (Some "B");
+r <- source None;
let
val onc = v <- get s; alert ("Now it's " ^ show v)
+ val onc_r = v <- get r; alert ("Changed to " ^ show v)
in
return <xml><body>
+ <h1>First group</h1>
+
<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.
+ <div>
+ Hello, I'm <dyn signal={s <- signal s; return <xml>{[s]}</xml>}/>. I'll be your waiter for this evening.
+ </div>
+
+ <h1>Second group</h1>
+
+ <label>X <cradio source={r} value="X" onchange={onc_r}/></label>
+ <label>Y <cradio source={r} value="Y" onchange={onc_r}/></label>
+ <label>Z <cradio source={r} value="Z" onchange={onc_r}/></label>
+
+ <div>Value: <dyn signal={r <- signal r; return <xml>{[r]}</xml>}/></div>
</body></xml>
end
diff --git a/tests/driver.sh b/tests/driver.sh
index cc62644b..879c093d 100755
--- a/tests/driver.sh
+++ b/tests/driver.sh
@@ -21,5 +21,5 @@ fi
$TESTSRV -q -a 127.0.0.1 &
echo $! >> $TESTPID
sleep 1
-python -m unittest $1.py
+python3 -m unittest $1.py
kill `cat $TESTPID`