summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls/tests/ReplaceContentTestCase.php
blob: 910b10639e3808ae2a8562db8aa5128632b0e8cb (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
92
93
94
95
<?php

class ReplaceContentTestCase extends SeleniumTestCase
{
	function test()
	{
		$this->skipBrowsers(self::INTERNET_EXPLORER);

		$this->open('active-controls/index.php?page=ReplaceContentTest');
		$this->assertTextPresent('Callback Replace Content Test');

		$this->assertText('subpanel', 'Sub Panel');
		$this->assertText('panel1', 'Main Panel Sub Panel');

		$this->type('content', 'something');

		$this->click('btn_append');
		$this->pause(800);

		$this->assertText('subpanel', 'Sub Panel something');
		$this->assertText('panel1', 'Main Panel Sub Panel something');

		$this->type('content', 'more');
		$this->click('btn_prepend');
		$this->pause(800);

		$this->assertText('subpanel', 'more Sub Panel something');
		$this->assertText('panel1', 'Main Panel more Sub Panel something');


		$this->type('content', 'prado');
		$this->click('btn_before');
		$this->pause(800);

		$this->assertText('subpanel', 'more Sub Panel something');
		$this->assertText('panel1', 'Main Panel pradomore Sub Panel something');

		$this->type('content', ' php ');
		$this->click('btn_after');
		$this->pause(800);

		$this->type('content', 'mauahahaha');
		$this->click('btn_replace');
		$this->pause(1000);

		$this->assertText('panel1', 'Main Panel pradomauahahahaphp');
	}

	function testIE()
	{
		$this->targetBrowsers(self::INTERNET_EXPLORER);

		$this->open('active-controls/index.php?page=ReplaceContentTest');
		$this->assertTextPresent('Callback Replace Content Test');

		$this->assertText('subpanel', 'Sub Panel');
		$this->assertText('panel1', 'regexp:Main Panel\s*Sub Panel');

		$this->type('content', 'something');

		$this->click('btn_append');
		$this->pause(800);

		$this->assertText('subpanel', 'Sub Panel something');
		$this->assertText('panel1', 'regexp:Main Panel\s*Sub Panel\s*something');

		$this->type('content', 'more');
		$this->click('btn_prepend');
		$this->pause(800);

		$this->assertText('subpanel', 'regexp:more\s*Sub Panel\s*something');
		$this->assertText('panel1', 'regexp:Main Panel\s*moreSub Panel\s*something');


		$this->type('content', 'prado');
		$this->click('btn_before');
		$this->pause(800);

		$this->assertText('subpanel', 'regexp:more\s*Sub Panel\s*something');
		$this->assertText('panel1', 'regexp:Main Panel\s*prado\s*more\s*Sub Panel\s*something');

		$this->type('content', ' php ');
		$this->click('btn_after');
		$this->pause(800);

		$this->type('content', 'mauahahaha');
		$this->click('btn_replace');
		$this->pause(1000);

		$this->assertText('panel1', 'Main Panel pradomauahahahaphp');
	}

}

?>