Skip to content

Commit ae942a7

Browse files
Jelle Henkensmarkstory
authored andcommitted
Added tests to test ajax settings
1 parent ac0b2b8 commit ae942a7

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

cake/tests/cases/libs/view/helpers/form.test.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5755,6 +5755,37 @@ function testCreate() {
57555755
'/div'
57565756
);
57575757
$this->assertTags($result, $expected);
5758+
5759+
$this->Form->request->data = array();
5760+
$this->Form->request['controller'] = 'contacts';
5761+
$this->Form->request['models'] = array('Contact' => array('plugin' => null, 'className' => 'Contact'));
5762+
$result = $this->Form->create(array('url' => array('action' => 'index', 'param'), 'default' => false));
5763+
$expected = array(
5764+
'form' => array(
5765+
'id' => 'ContactAddForm', 'method' => 'post', 'onsubmit' => 'event.returnValue = false; return false;', 'action' => '/contacts/index/param',
5766+
'accept-charset' => 'utf-8'
5767+
),
5768+
'div' => array('style' => 'display:none;'),
5769+
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
5770+
'/div'
5771+
);
5772+
$this->assertTags($result, $expected);
5773+
5774+
$this->Form->request->data = array();
5775+
$this->Form->request['controller'] = 'contacts';
5776+
$this->Form->request['models'] = array('Contact' => array('plugin' => null, 'className' => 'Contact'));
5777+
$result = $this->Form->create(array('url' => array('action' => 'index', 'param'), 'default' => false, 'onsubmit' => 'someFunction();'));
5778+
5779+
$expected = array(
5780+
'form' => array(
5781+
'id' => 'ContactAddForm', 'method' => 'post', 'onsubmit' => 'someFunction(); event.returnValue = false; return false;', 'action' => '/contacts/index/param',
5782+
'accept-charset' => 'utf-8'
5783+
),
5784+
'div' => array('style' => 'display:none;'),
5785+
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
5786+
'/div'
5787+
);
5788+
$this->assertTags($result, $expected);
57585789
}
57595790

57605791
/**

0 commit comments

Comments
 (0)