Commit 1cd3f2bb by Qiang Xue

Fixed test break.

parent bb7a6872
......@@ -170,13 +170,12 @@ class AssetBundle extends Object
list ($this->basePath, $this->baseUrl) = $am->publish($this->sourcePath, $this->publishOptions);
}
$converter = $am->getConverter();
$baseUrl = Yii::$app->getRequest()->getBaseUrl();
foreach ($this->js as $i => $js) {
if (strpos($js, '/') !== 0 && strpos($js, '://') === false) {
if (isset($this->basePath, $this->baseUrl)) {
$this->js[$i] = $converter->convert($js, $this->basePath, $this->baseUrl);
} else {
$this->js[$i] = $baseUrl . '/' . $js;
$this->js[$i] = '/' . $js;
}
}
}
......@@ -185,7 +184,7 @@ class AssetBundle extends Object
if (isset($this->basePath, $this->baseUrl)) {
$this->css[$i] = $converter->convert($css, $this->basePath, $this->baseUrl);
} else {
$this->css[$i] = $baseUrl . '/' . $css;
$this->css[$i] = '/' . $css;
}
}
}
......
......@@ -431,6 +431,9 @@ class View extends \yii\base\View
$this->jsFiles[$position][$key] = Html::jsFile($url, $options);
} else {
$am = Yii::$app->getAssetManager();
if (strpos($url, '/') !== 0 && strpos($url, '://') === false) {
$url = Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
}
$am->bundles[$key] = new AssetBundle([
'js' => [$url],
'jsOptions' => $options,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment