public function import($path) { if (!$this->docImported) { $this->docImported = true; $this->import('xatajax.doc.js'); } parent::import($path); }
function test_css() { $css = Dataface_CSSTool::getInstance(); $css->addPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'JavascriptToolTest' . DIRECTORY_SEPARATOR . 'css1', '/css1'); $js = new Dataface_JavascriptTool(); $js->clearCache(); $js->addPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'JavascriptToolTest' . DIRECTORY_SEPARATOR . 'js1', '/js1'); $js->addPath(DATAFACE_PATH . '/js', '/dataface/js'); $js->import('scriptE.js'); $actual = trim($js->getContents()); $expected = <<<END if(typeof(window.__xatajax_included__)!='object'){window.__xatajax_included__={};};(function(){var headtg=document.getElementsByTagName("head")[0];if(!headtg)return;var linktg=document.createElement("link");linktg.type="text/css";linktg.rel="stylesheet";linktg.href="http://example.com/site/index.php?-action=css&--id=styleA.css-efd492ea792872aeb8bf19070f7154fa";linktg.title="Styles";headtg.appendChild(linktg);})();if(typeof(window.__xatajax_included__['scriptE.js'])=='undefined'){window.__xatajax_included__['scriptE.js']=true;alert('script E');} END; $expected = trim($expected); $this->assertEquals($expected, $actual); $expected = ''; $actual = $js->getHtml(); $this->assertEquals($expected, $actual); }
public function copyTo(Dataface_JavascriptTool $target) { foreach ($this->includePath as $key => $val) { $target->addPath($key, $val); } foreach ($this->scripts as $key => $val) { $target->import($key); } $target->setUseCache($this->useCache); $target->setMinify($this->minify); }