summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php
blob: b0942ffac2953d680f26271f7d2a983fcb378ef1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

class ActiveRadioButtonListTestCase extends PradoGenericSeleniumTest
{
	function test()
	{
		$this->open("active-controls/index.php?page=ActiveRadioButtonListTest");
		$this->verifyTextPresent("TActiveRadioButtonList Test Case");

		$this->assertText("label1", "Label 1");


		$this->click("button3");
		$this->pause(800);
		$this->assertCheckBoxes(array(0));

		$this->click("button2");
		$this->pause(800);
		$this->assertCheckBoxes(array());

		$this->click("button4");
		$this->pause(800);
		$this->assertCheckBoxes(array(4));

		$this->click("list1_c2");
		$this->pause(800);
		$this->assertText("label1", "Selection: value 3");

		$this->click("list1_c3");
		$this->pause(800);
		$this->assertText("label1", "Selection: value 4");

	}

	function assertCheckBoxes($checks, $total = 5)
	{
		for($i = 0; $i < $total; $i++)
		{
			if(in_array($i, $checks))
				$this->assertChecked("list1_c{$i}");
			else
				$this->assertNotChecked("list1_c{$i}");
		}
	}
}