-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
614 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\BackendBrandingBundle\Tests\Controller; | ||
|
||
use Neusta\Pimcore\TestingFramework\Database\ResetDatabase; | ||
use Pimcore\Test\WebTestCase; | ||
use Spatie\Snapshots\MatchesSnapshots; | ||
|
||
class CssControllerTest extends WebTestCase | ||
{ | ||
use MatchesSnapshots; | ||
use ResetDatabase; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_returns_css(): void | ||
{ | ||
$client = self::createClient(); | ||
|
||
$client->request('GET', '/neusta/backend-branding/css'); | ||
|
||
self::assertResponseIsSuccessful(); | ||
self::assertResponseHeaderSame('Content-Type', 'text/css; charset=UTF-8'); | ||
$this->assertMatchesTextSnapshot($client->getResponse()->getContent()); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
tests/Controller/__snapshots__/CssControllerTest__it_returns_css__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
body.x-body #pimcore_body { | ||
background-color: #6428b4; | ||
} | ||
|
||
body.x-body #pimcore_loading.loaded { | ||
background-color: #6428b4; | ||
} | ||
|
||
body.x-body .sf-minitoolbar { | ||
background-color: #6428b4; | ||
} | ||
|
||
body.x-body #pimcore_panel_tabs > .x-panel-bodyWrap > .x-tab-bar { | ||
background-color: #6428b4; | ||
} | ||
|
||
#pimcore_loading.loaded { | ||
background-color: #6428b4; | ||
} | ||
|
||
.x-body .sf-minitoolbar { | ||
background-color: #6428b4; | ||
} | ||
|
||
#pimcore_sidebar { | ||
background-color: #028a0f; | ||
} | ||
|
||
#pimcore_loading.loaded { | ||
background-color: #028a0f; | ||
} | ||
|
||
.x-body .sf-minitoolbar { | ||
background-color: #028a0f; | ||
} | ||
|
||
#pimcore_signet { | ||
background-image: url("logo.svg"); | ||
background-size: 70%; | ||
background-position: center; | ||
background-color: #000 !important; | ||
} | ||
|
||
#pimcore_avatar { | ||
background-color: #000 !important; | ||
} | ||
|
||
#pimcore_panel_tabs > .x-panel-bodyWrap > .x-tab-bar { | ||
background-image: url("logo.svg"); | ||
background-size: 40px; | ||
background-position: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\BackendBrandingBundle\Tests\Css; | ||
|
||
use Neusta\Pimcore\BackendBrandingBundle\Css\CssProperty; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class CssPropertyTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_has_name_and_value(): void | ||
{ | ||
self::assertSame('color: red', (string) new CssProperty('color', 'red')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function its_value_may_be_a_url(): void | ||
{ | ||
self::assertSame( | ||
'background-image: url("image.jpeg")', | ||
(string) new CssProperty('background-image', 'image.jpeg', isUrl: true), | ||
); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_may_be_important(): void | ||
{ | ||
self::assertSame( | ||
'color: red !important', | ||
(string) new CssProperty('color', 'red', isImportant: true), | ||
); | ||
|
||
self::assertSame( | ||
'background-image: url("image.jpeg") !important', | ||
(string) new CssProperty('background-image', 'image.jpeg', isUrl: true, isImportant: true), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\BackendBrandingBundle\Tests\Css; | ||
|
||
use Neusta\Pimcore\BackendBrandingBundle\Css\CssProperty; | ||
use Neusta\Pimcore\BackendBrandingBundle\Css\CssRule; | ||
use Neusta\Pimcore\BackendBrandingBundle\Css\CssRuleList; | ||
use PHPUnit\Framework\TestCase; | ||
use Spatie\Snapshots\MatchesSnapshots; | ||
|
||
class CssRuleListTest extends TestCase | ||
{ | ||
use MatchesSnapshots; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_contains_a_bunch_of_rules(): void | ||
{ | ||
$ruleList = new CssRuleList(); | ||
|
||
$ruleList->addRule(new CssRule('#some-rule', | ||
new CssProperty('color', 'blue'), | ||
new CssProperty('margin', '0'), | ||
new CssProperty('display', 'block'), | ||
)); | ||
|
||
$ruleList->addRule(new CssRule('.another-rule', | ||
new CssProperty('background-image', 'image.jpg', isUrl: true), | ||
new CssProperty('padding', '0'), | ||
)); | ||
|
||
$ruleList->addRule(new CssRule('.some.specific .rule', | ||
new CssProperty('border', '5px solid black', isImportant: true), | ||
)); | ||
|
||
$this->assertMatchesTextSnapshot($ruleList->toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\BackendBrandingBundle\Tests\Css; | ||
|
||
use Neusta\Pimcore\BackendBrandingBundle\Css\CssProperty; | ||
use Neusta\Pimcore\BackendBrandingBundle\Css\CssRule; | ||
use PHPUnit\Framework\TestCase; | ||
use Spatie\Snapshots\MatchesSnapshots; | ||
|
||
class CssRuleTest extends TestCase | ||
{ | ||
use MatchesSnapshots; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_is_a_selector_with_properties(): void | ||
{ | ||
$this->assertMatchesTextSnapshot(new CssRule('.my-rule', | ||
new CssProperty('color', 'blue'), | ||
new CssProperty('margin', '0'), | ||
new CssProperty('display', 'block'), | ||
)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_overwrites_properties_with_the_same_name(): void | ||
{ | ||
$rule = new CssRule('.my-rule', | ||
new CssProperty('color', 'blue'), | ||
new CssProperty('margin', '0'), | ||
new CssProperty('display', 'block'), | ||
); | ||
|
||
$rule->setProperty(new CssProperty('display', 'inline')); | ||
|
||
$this->assertMatchesTextSnapshot($rule); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/Css/__snapshots__/CssRuleListTest__it_contains_a_bunch_of_rules__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#some-rule { | ||
color: blue; | ||
margin: 0; | ||
display: block; | ||
} | ||
|
||
.another-rule { | ||
background-image: url("image.jpg"); | ||
padding: 0; | ||
} | ||
|
||
.some.specific .rule { | ||
border: 5px solid black !important; | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/Css/__snapshots__/CssRuleTest__it_is_a_selector_with_properties__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.my-rule { | ||
color: blue; | ||
margin: 0; | ||
display: block; | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/Css/__snapshots__/CssRuleTest__it_overwrites_properties_with_the_same_name__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.my-rule { | ||
color: blue; | ||
margin: 0; | ||
display: inline; | ||
} |
Oops, something went wrong.