mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updatin HtmlHelper::css() to accept .css?1234, closes #3503
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6080 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
28ada1f684
commit
101ebba716
2 changed files with 20 additions and 1 deletions
|
@ -313,7 +313,12 @@ class HtmlHelper extends AppHelper {
|
|||
}
|
||||
return;
|
||||
}
|
||||
$url = $this->webroot((COMPRESS_CSS ? 'c' : '') . CSS_URL . $path . ".css");
|
||||
|
||||
if (strpos($path, '.css') === false && strpos($path, '?') === false) {
|
||||
$path .= '.css';
|
||||
}
|
||||
|
||||
$url = $this->webroot((COMPRESS_CSS ? 'c' : '') . CSS_URL . $path);
|
||||
if ($rel == 'import') {
|
||||
$out = sprintf($this->tags['style'], $this->_parseAttributes($htmlAttributes, null, '', ' '), '@import url(' . $url . ');');
|
||||
} else {
|
||||
|
|
|
@ -79,6 +79,20 @@ class HtmlHelperTest extends UnitTestCase {
|
|||
$this->assertPattern('/^<link[^<>]+type="text\/css"[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+href=".*css\/screen\.css"[^<>]+\/>$/', $result);
|
||||
$this->assertNoPattern('/^<link[^<>]+[^rel|type|href]=[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Html->css('screen.css');
|
||||
$this->assertPattern('/^<link[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+rel="stylesheet"[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+type="text\/css"[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+href=".*css\/screen\.css"[^<>]+\/>$/', $result);
|
||||
$this->assertNoPattern('/^<link[^<>]+[^rel|type|href]=[^<>]*>/', $result);
|
||||
|
||||
$result = $this->Html->css('screen.css?1234');
|
||||
$this->assertPattern('/^<link[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+rel="stylesheet"[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+type="text\/css"[^<>]+\/>$/', $result);
|
||||
$this->assertPattern('/^<link[^<>]+href=".*css\/screen\.css\?1234"[^<>]+\/>$/', $result);
|
||||
$this->assertNoPattern('/^<link[^<>]+[^rel|type|href]=[^<>]*>/', $result);
|
||||
}
|
||||
|
||||
function testBreadcrumb() {
|
||||
|
|
Loading…
Reference in a new issue