summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls/tests/ActiveRadioButtonListTestCase.php
blob: 824087322d9a8775e5b667e5f4b63977b8b89bd4 (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
46
47
<?php

class ActiveRadioButtonListTestCase extends PradoGenericSelenium2Test
{
	function test()
	{
		$base='ctl0_Content_';
		$this->url("active-controls/index.php?page=ActiveRadioButtonListTest");
		$this->assertContains("TActiveRadioButtonList Test Case", $this->source());

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


		$this->byId("{$base}button3")->click();
		$this->pause(800);
		$this->assertCheckBoxes(array(0));

		$this->byId("{$base}button2")->click();
		$this->pause(800);
		$this->assertCheckBoxes(array());

		$this->byId("{$base}button4")->click();
		$this->pause(800);
		$this->assertCheckBoxes(array(4));

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

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

	}

	function assertCheckBoxes($checks, $total = 5)
	{
		$base='ctl0_Content_';
		for($i = 0; $i < $total; $i++)
		{
			if(in_array($i, $checks))
				$this->assertTrue($this->byId("{$base}list1_c{$i}")->selected());
			else
				$this->assertFalse($this->byId("{$base}list1_c{$i}")->selected());
		}
	}
}