Permalink
Browse files

Added tests to test ajax settings

  • Loading branch information...
1 parent ac0b2b8 commit ae942a7f7bf15beb9e03ee576d09713d7d52dbe0 Jelle Henkens committed with markstory Sep 7, 2011
Showing with 31 additions and 0 deletions.
  1. +31 −0 cake/tests/cases/libs/view/helpers/form.test.php
@@ -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);
}
/**

0 comments on commit ae942a7

Please sign in to comment.