Explorar o código

ZF-11315: render hidden element last when rendering Editor dijit

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23937 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew %!s(int64=14) %!d(string=hai) anos
pai
achega
2ea7ec3a08

+ 3 - 2
library/Zend/Dojo/View/Helper/Editor.php

@@ -121,8 +121,7 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
 
         $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
 
-        $html  = '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
-        $html .= '<div' . $this->_htmlAttribs($attribs) . '>'
+        $html  = '<div' . $this->_htmlAttribs($attribs) . '>'
                . $value
                . "</div>\n";
 
@@ -132,6 +131,8 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
                . $this->view->formTextarea($hiddenId, $value, $attribs)
                . '</noscript>';
 
+        $html  .= '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
+        
         return $html;
     }
 

+ 9 - 0
tests/Zend/Dojo/View/Helper/EditorTest.php

@@ -211,6 +211,15 @@ class Zend_Dojo_View_Helper_EditorTest extends PHPUnit_Framework_TestCase
         $html = $this->helper->editor('foo');
         $this->assertRegexp('#<noscript><textarea[^>]*>#', $html, $html);
     }
+
+    /**
+     * @group ZF-11315
+     */
+    public function testHiddenInputShouldBeRenderedLast()
+    {
+        $html = $this->helper->editor('foo');
+        $this->assertRegexp('#</noscript><input#', $html, $html);
+    }
 }
 
 // Call Zend_Dojo_View_Helper_EditorTest::main() if this source file is executed directly.