-
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.
Vite Locator interface improved to enable relative path handling
Also includes tests, code improvements and fixes.
- Loading branch information
Showing
16 changed files
with
534 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
# | ||
# +--------------------------------------------+ | ||
# | IDEs & platform ballast | | ||
# +--------------------------------------------+ | ||
# | ||
.idea | ||
vendor | ||
composer.lock | ||
|
||
|
||
# | ||
# +--------------------------------------------+ | ||
# | Vendor & Composer stuff | | ||
# +--------------------------------------------+ | ||
# | ||
vendor/* | ||
composer.lock | ||
|
||
|
||
# | ||
# +--------------------------------------------+ | ||
# | Build & test artefacts | | ||
# +--------------------------------------------+ | ||
# | ||
tests/output/* | ||
!tests/output/.gitkeep | ||
tests/workdir/* | ||
!tests/workdir/.gitkeep |
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
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,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace Dakujem\Trest; | ||
|
||
require_once __DIR__ . '/common.php'; | ||
|
||
use Dakujem\Peat\ViteEntryAsset; | ||
use Tester\Assert; | ||
use Tester\TestCase; | ||
|
||
/** | ||
* This test tests the capabilities on the official Vite backend integration example. | ||
* | ||
* @author Andrej Rypak (dakujem) <[email protected]> | ||
*/ | ||
class _DefaultViteAssetTest extends TestCase | ||
{ | ||
public function testEmptyAsset() | ||
{ | ||
$asset = new ViteEntryAsset(); | ||
|
||
Assert::same('', (string)$asset); | ||
Assert::same([], $asset->modules()); | ||
Assert::same([], $asset->css()); | ||
Assert::same(['modules' => [], 'css' => [],], $asset->jsonSerialize()); | ||
} | ||
|
||
public function testNonEmptyAsset() | ||
{ | ||
$asset = new ViteEntryAsset(['a', 'b'], ['c', 'd']); | ||
|
||
Assert::same('<script type="module" src="a"></script>' . "\n" . | ||
'<script type="module" src="b"></script>' . "\n" . | ||
'<link rel="stylesheet" href="c" />' . "\n" . | ||
'<link rel="stylesheet" href="d" />' | ||
, (string)$asset); | ||
Assert::same(['a', 'b'], $asset->modules()); | ||
Assert::same(['c', 'd'], $asset->css()); | ||
Assert::same(['modules' => ['a', 'b'], 'css' => ['c', 'd'],], $asset->jsonSerialize()); | ||
} | ||
} | ||
|
||
// run the test | ||
(new _DefaultViteAssetTest)->run(); |
Oops, something went wrong.