mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding AjaxHelper tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4458 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
825897cd39
commit
454d9716d2
1 changed files with 12 additions and 0 deletions
|
@ -47,6 +47,18 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->ajax->Javascript = new JavascriptHelper();
|
||||
}
|
||||
|
||||
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>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
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>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testDraggable() {
|
||||
$result = $this->ajax->drag('id', array('handle' => 'other_id'));
|
||||
$expected = '<script type="text/javascript">new Draggable(\'id\', {handle:\'other_id\'});</script>';
|
||||
|
|
Loading…
Add table
Reference in a new issue