mirror of
https://github.com/getgrav/grav.git
synced 2026-05-05 20:57:15 +02:00
✅ Test Assets::resetJs() and Assets::resetCss()
Also fix closing parentheses. Added PHPDoc
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
use Codeception\Util\Fixtures;
|
||||
|
||||
/**
|
||||
* Class AssetsTest
|
||||
*/
|
||||
class AssetsTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
/**
|
||||
@@ -329,7 +332,9 @@ class AssetsTest extends \Codeception\TestCase\Test
|
||||
$assets->reset();
|
||||
$assets->addInlineJs('alert("test")');
|
||||
$js = $assets->js();
|
||||
$this->assertSame($js, PHP_EOL. '<script>' .PHP_EOL . 'alert("test")' . PHP_EOL.PHP_EOL .'</script>' . PHP_EOL);
|
||||
$this->assertSame($js,
|
||||
PHP_EOL . '<script>' . PHP_EOL . 'alert("test")' . PHP_EOL . PHP_EOL . '</script>' . PHP_EOL);
|
||||
}
|
||||
|
||||
public function testGetCollections()
|
||||
{
|
||||
@@ -380,4 +385,35 @@ class AssetsTest extends \Codeception\TestCase\Test
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
}
|
||||
|
||||
public function testResetJs()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$assets->addInlineJs('alert("test")');
|
||||
$assets->resetJs();
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
|
||||
$assets->addAsyncJs('jquery');
|
||||
$assets->resetJs();
|
||||
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
}
|
||||
|
||||
public function testResetCss()
|
||||
{
|
||||
$assets = $this->assets();
|
||||
|
||||
$this->assertTrue(count($assets->js()) == 0);
|
||||
|
||||
$assets->addInlineCss('body { color: black }');
|
||||
$assets->resetCss();
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
|
||||
$assets->add('/system/assets/debugger.css', null, true);
|
||||
$assets->resetCss();
|
||||
|
||||
$this->assertTrue(count($assets->css()) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user