Skip to content

Commit

Permalink
Added tests to test ajax settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelle Henkens authored and markstory committed Sep 8, 2011
1 parent ac0b2b8 commit ae942a7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cake/tests/cases/libs/view/helpers/form.test.php
Expand Up @@ -5755,6 +5755,37 @@ function testCreate() {
'/div'
);
$this->assertTags($result, $expected);

$this->Form->request->data = array();
$this->Form->request['controller'] = 'contacts';
$this->Form->request['models'] = array('Contact' => array('plugin' => null, 'className' => 'Contact'));
$result = $this->Form->create(array('url' => array('action' => 'index', 'param'), 'default' => false));
$expected = array(
'form' => array(
'id' => 'ContactAddForm', 'method' => 'post', 'onsubmit' => 'event.returnValue = false; return false;', 'action' => '/contacts/index/param',
'accept-charset' => 'utf-8'
),
'div' => array('style' => 'display:none;'),
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
'/div'
);
$this->assertTags($result, $expected);

$this->Form->request->data = array();
$this->Form->request['controller'] = 'contacts';
$this->Form->request['models'] = array('Contact' => array('plugin' => null, 'className' => 'Contact'));
$result = $this->Form->create(array('url' => array('action' => 'index', 'param'), 'default' => false, 'onsubmit' => 'someFunction();'));

$expected = array(
'form' => array(
'id' => 'ContactAddForm', 'method' => 'post', 'onsubmit' => 'someFunction(); event.returnValue = false; return false;', 'action' => '/contacts/index/param',
'accept-charset' => 'utf-8'
),
'div' => array('style' => 'display:none;'),
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
'/div'
);
$this->assertTags($result, $expected);
}

/**
Expand Down

0 comments on commit ae942a7

Please sign in to comment.