Fixing JavascriptHelper::link() for script files outside of webroot/js (i.e. plugins), fixes #3799

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6313 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-01-02 19:32:46 +00:00
parent 181aa97ca1
commit 93f034b9bd
2 changed files with 8 additions and 1 deletions

View file

@ -162,7 +162,10 @@ class JavascriptHelper extends AppHelper {
}
if (strpos($url, '://') === false) {
$url = $this->webroot(JS_URL . $url);
if ($url{0} !== '/') {
$url = JS_URL . $url;
}
$url = $this->webroot($url);
if (Configure::read('Asset.filter.js')) {
$url = str_replace(JS_URL, 'cjs/', $url);

View file

@ -80,6 +80,10 @@ class JavascriptTest extends UnitTestCase {
$result = $this->Javascript->link('jquery-1.1.2');
$this->assertPattern('/^<script[^<>]+src=".*cjs\/jquery-1\.1\.2\.js"[^<>]*>/', $result);
Configure::write('Asset.filter.js', false);
$result = $this->Javascript->link('/plugin/js/jquery-1.1.2');
$expected = '<script type="text/javascript" src="/plugin/js/jquery-1.1.2.js"></script>';
$this->assertEqual($result, $expected);
}
function testObjectGeneration() {