Skip to content
This repository
Browse code

Added tests to test ajax settings

  • Loading branch information...
commit 3c8c2936b33d9869d350dfec3ddc0be381d9f16d 1 parent 9587892
Jelle Henkens authored September 07, 2011 markstory committed September 07, 2011
31  lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -6073,6 +6073,37 @@ public function testCreate() {
6073 6073
 			'/div'
6074 6074
 		);
6075 6075
 		$this->assertTags($result, $expected);
  6076
+
  6077
+		$this->Form->request->data = array();
  6078
+		$this->Form->request['controller'] = 'contacts';
  6079
+		$this->Form->request['models'] = array('Contact' => array('plugin' => null, 'className' => 'Contact'));
  6080
+		$result = $this->Form->create(array('url' => array('action' => 'index', 'param'), 'default' => false));
  6081
+		$expected = array(
  6082
+			'form' => array(
  6083
+				'id' => 'ContactAddForm', 'method' => 'post', 'onsubmit' => 'event.returnValue = false; return false;', 'action' => '/contacts/index/param',
  6084
+				'accept-charset' => 'utf-8'
  6085
+			),
  6086
+			'div' => array('style' => 'display:none;'),
  6087
+			'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
  6088
+			'/div'
  6089
+		);
  6090
+		$this->assertTags($result, $expected);
  6091
+
  6092
+		$this->Form->request->data = array();
  6093
+		$this->Form->request['controller'] = 'contacts';
  6094
+		$this->Form->request['models'] = array('Contact' => array('plugin' => null, 'className' => 'Contact'));
  6095
+		$result = $this->Form->create(array('url' => array('action' => 'index', 'param'), 'default' => false, 'onsubmit' => 'someFunction();'));
  6096
+
  6097
+		$expected = array(
  6098
+			'form' => array(
  6099
+				'id' => 'ContactAddForm', 'method' => 'post', 'onsubmit' => 'someFunction(); event.returnValue = false; return false;', 'action' => '/contacts/index/param',
  6100
+				'accept-charset' => 'utf-8'
  6101
+			),
  6102
+			'div' => array('style' => 'display:none;'),
  6103
+			'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
  6104
+			'/div'
  6105
+		);
  6106
+		$this->assertTags($result, $expected);
6076 6107
 	}
6077 6108
 
6078 6109
 /**

0 notes on commit 3c8c293

Please sign in to comment.
Something went wrong with that request. Please try again.