summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php
blob: 0f512d2c49b59222df1466a6692da124d9b2aa0c (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php

class QuickstartTextBoxTestCase extends PradoGenericSelenium2Test
{
	function test ()
	{
		$this->url("../../demos/quickstart/index.php?page=Controls.Samples.TTextBox.Home&amp;notheme=true&amp;lang=en");

		$this->verifyTitle("PRADO QuickStart Sample", "");

		// a normal textbox
		$this->type("ctl0\$body\$ctl0", "test");

		// textbox with maxlength set
		$this->verifyAttribute("ctl0\$body\$ctl1@size","4");
		$this->verifyAttribute("ctl0\$body\$ctl1@maxlength","6");
		$this->type("ctl0\$body\$ctl1", "textte");

		// vCard textboxes
		$this->verifyAttribute("ctl0\$body\$ctl2@vcard_name","vCard.FirstName");
		$this->type("ctl0\$body\$ctl2", "first");
		$this->verifyAttribute("ctl0\$body\$ctl3@vcard_name","vCard.LastName");
		$this->type("ctl0\$body\$ctl3", "last");

		// a disabled textbox
		$this->verifyAttribute("ctl0\$body\$ctl4@disabled","regexp:true|disabled");

		// a read-only textbox
		$this->verifyAttribute("ctl0\$body\$ctl5@readonly","regexp:true|readonly");

		// auto postback textbox, CausesValidation=false
		$this->assertValue("ctl0\$body\$ctl6", "change me");
		$this->type("ctl0\$body\$ctl6", "change mes");
		$this->assertValue("ctl0\$body\$ctl6", "text changed");

		// auto postback textbox, CausesValidation=true
		$this->assertNotVisible('ctl0_body_ctl7');
		$this->type("ctl0\$body\$TextBox3", "test");
//		$this->pause(1000);
		$this->assertVisible('ctl0_body_ctl7');
		$this->type("ctl0\$body\$TextBox3", "non test");
		$this->assertNotVisible('ctl0_body_ctl7');

		// submitting textbox with a button
		$this->type("ctl0\$body\$TextBox1", "texttext");
		$this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
		$this->assertValue("ctl0\$body\$TextBox1", "You just entered 'texttext'.");

		// SafeText
		$this->assertText("ctl0_body_Output","test");
		$this->type("ctl0\$body\$TextBox2","<a href=javascript:xxx>malicious code</a>");
		$this->assertText("ctl0_body_Output","malicious code");

		// password
		$this->verifyAttribute("ctl0\$body\$ctl9@type","password");

		// ------------------multiline textbox----------------------

		// regular textbox
		$this->type("ctl0\$body\$ctl10", "This is a\nmultiline\ntextbox.");
		$this->type("ctl0\$body\$ctl11", "This is a multiline text box.
In HTML, it is displayed as a textarea.
End of message
");

		// a disabled multiline textbox
		$this->verifyAttribute("ctl0\$body\$ctl12@disabled","regexp:true|disabled");

		// a read-only multiline textbox
		$this->verifyAttribute("ctl0\$body\$ctl13@readonly","regexp:true|readonly");
		$this->verifyAttribute("ctl0\$body\$ctl13@wrap","off");

		// auto postback textbox
		$this->assertValue("ctl0\$body\$ctl14", "change me");
		$this->type("ctl0\$body\$ctl14", "change mes");
		$this->assertValue("ctl0\$body\$ctl14", "text changed");
		$this->assertValue("ctl0\$body\$ctl10", "This is a\nmultiline\ntextbox.");
		$this->assertValue("ctl0\$body\$ctl11", "This is a multiline text box.
In HTML, it is displayed as a textarea.
End of message
");

		// textbox associated with a validator
		$this->assertNotVisible('ctl0_body_ctl15');
		$this->type("ctl0\$body\$MultiTextBox3", "demo");
//		$this->pause(1000);
		$this->assertVisible('ctl0_body_ctl15');
		$this->type("ctl0\$body\$MultiTextBox3", "non demo");
		$this->assertNotVisible('ctl0_body_ctl15');
	}
}