public function testShouldNotAllowAddingDuplicateArbitraryJsToPrimaryDojoScriptTag() { $this->helper->addJavascript('var foo = "bar";'); $this->helper->addJavascript('var foo = "bar";'); $js = $this->helper->getJavascript(); $this->assertTrue(is_array($js)); $this->assertEquals(1, count($js), var_export($js, 1)); $this->assertEquals('var foo = "bar";', $js[0]); }
/** * Create JS function for retrieving parent form * * @return void */ protected function _createGetParentFormFunction() { $function = <<<EOJ if (zend == undefined) { var zend = {}; } zend.findParentForm = function(elementNode) { while (elementNode.nodeName.toLowerCase() != 'form') { elementNode = elementNode.parentNode; } return elementNode; }; EOJ; $this->dojo->addJavascript($function); }