Browse Source

ZF-5711: allow extraPlugins to be JSON encoded

- Addes "extraPlugins" key to parameters to serialize to JSON in Editor
  dijit

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24190 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 14 years ago
parent
commit
bcc5df9907

+ 1 - 1
library/Zend/Dojo/View/Helper/Editor.php

@@ -71,7 +71,7 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
      * JSON-encoded parameters
      * @var array
      */
-    protected $_jsonParams = array('captureEvents', 'events', 'plugins');
+    protected $_jsonParams = array('captureEvents', 'events', 'plugins', 'extraPlugins');
 
     /**
      * dijit.Editor

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

@@ -220,6 +220,16 @@ class Zend_Dojo_View_Helper_EditorTest extends PHPUnit_Framework_TestCase
         $html = $this->helper->editor('foo');
         $this->assertRegexp('#</noscript><input#', $html, $html);
     }
+
+    /** @group ZF-5711 */
+    public function testHelperShouldJsonifyExtraPlugins()
+    {
+        $extraPlugins = array('copy', 'cut', 'paste');
+        $html = $this->helper->editor('foo', '', array('extraPlugins' => $extraPlugins));
+        $pluginsString = Zend_Json::encode($extraPlugins);
+        $pluginsString = str_replace('"', "'", $pluginsString);
+        $this->assertContains('extraPlugins="' . $pluginsString . '"', $html);
+    }
 }
 
 // Call Zend_Dojo_View_Helper_EditorTest::main() if this source file is executed directly.