Browse Source

Update Zend_Dojo tests to take into account that the json within a declarative digit is rendered with a single quote rather than the expected double quote. Allow for the fact that the single quote is then converted to '

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24719 44c647ce-9c0f-0410-b52a-842ac1e357ba
rob 13 năm trước cách đây
mục cha
commit
192ac19c61

+ 2 - 0
tests/Zend/Dojo/Form/Element/NumberSpinnerTest.php

@@ -195,6 +195,8 @@ class Zend_Dojo_Form_Element_NumberSpinnerTest extends PHPUnit_Framework_TestCas
         $this->element->setMin(5)
                       ->setMax(10);
         $html = $this->element->render();
+        // Note that ' is converted to ' in Zend_View_Helper_HtmlElement::_htmlAttribs() (line 116)
+        $html = str_replace(''', "'", $html);
         $this->assertRegexp('/\'min\':\s*5/', $html, $html);
         $this->assertRegexp('/\'max\':\s*10/', $html, $html);
     }

+ 2 - 1
tests/Zend/Dojo/View/Helper/HorizontalSliderTest.php

@@ -195,7 +195,8 @@ class Zend_Dojo_View_Helper_HorizontalSliderTest extends PHPUnit_Framework_TestC
     public function testShouldCreateOnChangeAttributeByDefault()
     {
         $html = $this->getElement();
-        $this->assertContains('onChange="dojo.byId(\'elementId\').value = arguments[0];"', $html, $html);
+        // Note that ' is converted to ' in Zend_View_Helper_HtmlElement::_htmlAttribs() (line 116)
+        $this->assertContains('onChange="dojo.byId('elementId').value = arguments[0];"', $html, $html);
     }
 
     public function testShouldCreateHiddenElementWithValue()

+ 4 - 0
tests/Zend/Dojo/View/Helper/NumberSpinnerTest.php

@@ -138,6 +138,10 @@ class Zend_Dojo_View_Helper_NumberSpinnerTest extends PHPUnit_Framework_TestCase
             $this->fail('Did not serialize constraints');
         }
         $constraints = str_replace("'", '"', $m[1]);
+        if (Zend_Dojo_View_Helper_Dojo::useDeclarative()) {
+            // Convert ' to "'" for json_decode. See Zend_Dojo_View_Helper_Dijit::_prepareDijit() (line 254)
+            $constraints = str_replace(''', '"', $constraints);
+        }
         $constraints = Zend_Json::decode($constraints);
         $this->assertTrue(is_array($constraints), var_export($m[1], 1));
         $this->assertTrue(array_key_exists('min', $constraints));

+ 2 - 1
tests/Zend/Dojo/View/Helper/VerticalSliderTest.php

@@ -188,7 +188,8 @@ class Zend_Dojo_View_Helper_VerticalSliderTest extends PHPUnit_Framework_TestCas
     public function testShouldCreateOnChangeAttributeByDefault()
     {
         $html = $this->getElement();
-        $this->assertContains('onChange="dojo.byId(\'elementId\').value = arguments[0];"', $html, $html);
+        // Note that ' is converted to ' in Zend_View_Helper_HtmlElement::_htmlAttribs() (line 116)
+        $this->assertContains('onChange="dojo.byId('elementId').value = arguments[0];"', $html, $html);
     }
 
     public function testShouldCreateHiddenElementWithValue()