Ejemplo n.º 1
0
 function testCompile()
 {
     $script = 'function hello() {var longName = confirm("message")}';
     $result = JsCompiler::compile($script);
     $expected = 'function hello(){var a=confirm("message")};' . "\n";
     $this->assertEqual($result, $expected);
 }
Ejemplo n.º 2
0
 /**
  * Returns the compiled an minified version of the script files suplied
  *
  * @param array $assets array of asset files to process
  * @return string the compiled and minified version of the scripts
  * @access private
  */
 function compileJs($assets)
 {
     App::import('Lib', 'Asset.JsCompiler');
     $contents = '';
     foreach ($assets as $asset) {
         $contents .= $this->__getFileContents($asset, 'js') . "\n";
     }
     return JsCompiler::compile($contents);
 }