Skip to content
This repository
Browse code

Preventing `\template\Helper` from being too smart about attribute mi…

…nimization.
  • Loading branch information...
commit ffe62c6fa54e04bde2c9547cdf1d597e5a5dcf30 1 parent 0334f33
Nate Abele authored
2  libraries/lithium/template/Helper.php
@@ -137,7 +137,7 @@ protected function _formatAttr($key, $value, array $options = array()) {
137 137
 		$options += $defaults;
138 138
 
139 139
 		if (in_array($key, $this->_minimized)) {
140  
-			$isMini = ($value == 1 || $value === true || $value === 'true' || $value == $key);
  140
+			$isMini = ($value == 1 || $value === true || $value == $key);
141 141
 			if (!($value = $isMini ? $key : $value)) {
142 142
 				return null;
143 143
 			}
17  libraries/lithium/tests/cases/template/HelperTest.php
@@ -88,6 +88,23 @@ public function testAttributes() {
88 88
 		$this->assertEqual($expected, $result);
89 89
 	}
90 90
 
  91
+	public function testAttributeMinimization() {
  92
+		$attributes = array('selected' => 1);
  93
+		$expected = ' selected="selected"';
  94
+		$result = $this->helper->testAttributes($attributes);
  95
+		$this->assertEqual($expected, $result);
  96
+
  97
+		$attributes = array('selected' => true);
  98
+		$expected = ' selected="selected"';
  99
+		$result = $this->helper->testAttributes($attributes);
  100
+		$this->assertEqual($expected, $result);
  101
+
  102
+		$attributes = array('selected' => 'true');
  103
+		$expected = ' selected="true"';
  104
+		$result = $this->helper->testAttributes($attributes);
  105
+		$this->assertEqual($expected, $result);
  106
+	}
  107
+
91 108
 	public function testRender() {
92 109
 		$params = array(
93 110
 			'context' => new MockRenderer(),

0 notes on commit ffe62c6

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