mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Updating AjaxTest with changes made for #3271
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5798 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ffc1e3d93f
commit
8268ba8c59
1 changed files with 10 additions and 16 deletions
|
@ -75,11 +75,11 @@ class AjaxTest extends UnitTestCase {
|
|||
|
||||
function testEvalScripts() {
|
||||
$result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content', 'evalScripts' => false));
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:false, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$expected = '<a href="/" id="link1" onclick=" event.returnValue = false; return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:false, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content'));
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$expected = '<a href="/" id="link1" onclick=" event.returnValue = false; return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class AjaxTest extends UnitTestCase {
|
|||
|
||||
function testAsynchronous() {
|
||||
$result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content', 'type' => 'synchronous'));
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:false, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$expected = '<a href="/" id="link1" onclick=" event.returnValue = false; return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:false, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,7 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->assertPattern('/^<a[^<>]+>Ajax Link<\/a><script [^<>]+>[^<>]+<\/script>$/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+href="http:\/\/www.cakephp.org\/downloads"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+id="link\d+"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href|id|onclick]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*event.returnValue = false;\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/Event.observe\(\'link\d+\',\s*\'click\',\s*function\(event\)\s*{.+},\s*false\);<\/script>$/', $result);
|
||||
|
@ -148,19 +147,17 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->assertPattern('/^<a[^<>]+>Ajax Link<\/a><script [^<>]+>[^<>]+<\/script>$/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+href="http:\/\/www.cakephp.org\/downloads"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+id="link\d+"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href|id|onclick]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*event.returnValue = false;\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/Event.observe\(\'link\d+\',\s*\'click\',\s*function\(event\)\s*{.+},\s*false\);<\/script>$/', $result);
|
||||
$this->assertPattern('/function\(event\)\s*{\s*if \(confirm\(\'Are you sure & positive\?\'\)\) {\s*new Ajax\.Request\(\'http:\/\/www.cakephp.org\/downloads\',\s*{asynchronous:true, evalScripts:true}\);\s*}\s*else\s*{\s*return false;\s*}\s*},\s*false\);/', $result);
|
||||
$this->assertPattern('/function\(event\)\s*{\s*if \(confirm\(\'Are you sure & positive\?\'\)\) {\s*new Ajax\.Request\(\'http:\/\/www.cakephp.org\/downloads\',\s*{asynchronous:true, evalScripts:true}\);\s*}\s*else\s*{\s*event.returnValue = false;\s*return false;\s*}\s*},\s*false\);/', $result);
|
||||
|
||||
$result = $this->Ajax->link('Ajax Link', 'http://www.cakephp.org/downloads', array('update' => 'myDiv'));
|
||||
$this->assertPattern('/^<a[^<>]+>Ajax Link<\/a><script [^<>]+>[^<>]+<\/script>$/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+href="http:\/\/www.cakephp.org\/downloads"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+id="link\d+"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href|id|onclick]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*event.returnValue = false;\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/Event.observe\(\'link\d+\',\s*\'click\',\s*function\(event\)\s*{.+},\s*false\);<\/script>$/', $result);
|
||||
|
@ -170,8 +167,7 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->assertPattern('/^<a[^<>]+>Ajax Link<\/a><script [^<>]+>[^<>]+<\/script>$/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+href="http:\/\/www.cakephp.org\/downloads"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+id="myLink"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href|id|onclick]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*event.returnValue = false;\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/Event.observe\(\'myLink\',\s*\'click\',\s*function\(event\)\s*{.+},\s*false\);<\/script>$/', $result);
|
||||
|
@ -181,8 +177,7 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->assertPattern('/^<a[^<>]+>Ajax Link<\/a><script [^<>]+>[^<>]+<\/script>$/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+href="http:\/\/www.cakephp.org\/downloads"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+id="myLink"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href|id|onclick]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*event.returnValue = false;\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/Event.observe\(\'myLink\',\s*\'click\',\s*function\(event\)\s*{.+},\s*false\);<\/script>$/', $result);
|
||||
|
@ -192,8 +187,7 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->assertPattern('/^<a[^<>]+>Ajax Link<\/a><script [^<>]+>[^<>]+<\/script>$/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+href="http:\/\/www.cakephp.org\/downloads"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+id="myLink"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<a[^<>]+[^href|id|onclick]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<a[^<>]+onclick="\s*event.returnValue = false;\s*return false;"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<script[^<>]+type="text\/javascript"[^<>]*>/', $result);
|
||||
$this->assertNoPattern('/<script[^<>]+[^type]=[^<>]*>/', $result);
|
||||
$this->assertPattern('/Event.observe\(\'myLink\',\s*\'click\',\s*function\(event\)\s*{.+},\s*false\);<\/script>$/', $result);
|
||||
|
|
Loading…
Add table
Reference in a new issue