Permalink
Browse files

Added tests to test ajax settings

  • Loading branch information...
1 parent 9587892 commit 3c8c2936b33d9869d350dfec3ddc0be381d9f16d Jelle Henkens committed with markstory Sep 7, 2011
Showing with 31 additions and 0 deletions.
  1. +31 −0 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -6073,6 +6073,37 @@ public 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 3c8c293

Please sign in to comment.