public function testIgnoresNonJsExtensions() { $viewFilter = new \Elgg\Amd\ViewFilter(); $originalContent = "// Comment\ndefine('any/mod', {})"; $filteredContent = $viewFilter->filter('js/foobar/my/mod.jst', $originalContent); $this->assertEquals($originalContent, $filteredContent); }
public function testLeavesNamedModulesAlone() { $viewFilter = new \Elgg\Amd\ViewFilter(); $originalContent = "// Comment\ndefine('any/mod', {})"; $filteredContent = $viewFilter->filter('js/my/mod.js', $originalContent); $this->assertEquals($originalContent, $filteredContent); }
/** * Inserts module names into anonymous modules by handling the "simplecache:generate" hook. * * @param string $hook The name of the hook * @param string $type View type (css, js, or unknown) * @param string $content Content of the view * @param array $params Array of parameters * * @return string|null View content minified (if css/js type) * @access private */ function _elgg_views_amd($hook, $type, $content, $params) { $filter = new \Elgg\Amd\ViewFilter(); return $filter->filter($params['view'], $content); }