generated from fidum/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix #13 handle absolute url assets * Fix styling * Fix #13 handle absolute url assets * wip * wip * wip * Fix styling * wip * wip * wip * wip * wip --------- Co-authored-by: dmason30 <[email protected]>
- Loading branch information
Showing
12 changed files
with
82 additions
and
37 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
8 changes: 8 additions & 0 deletions
8
...pest/snapshots/PublishCommandTest/it_finds_and_bundles_registered_scripts_and_styles.snap
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,8 @@ | ||
/** Test JS content **/ | ||
/** Public JS content **/ | ||
'use strict'; | ||
|
||
module.exports = function isObject(x) { | ||
return typeof x === 'object' && x !== null; | ||
}; | ||
/** Tool JS content **/ |
4 changes: 4 additions & 0 deletions
4
...t/snapshots/PublishCommandTest/it_finds_and_bundles_registered_scripts_and_styles__2.snap
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,4 @@ | ||
/** Test CSS content **/ | ||
/** Public CSS content **/ | ||
.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}@media (min-width:640px){.sm\:container{width:100%}@media (min-width:640px){.sm\:container{max-width:640px}}@media (min-width:768px){.sm\:container{max-width:768px}}@media (min-width:1024px){.sm\:container{max-width:1024px}}@media (min-width:1280px){.sm\:container{max-width:1280px}}@media (min-width:1536px){.sm\:container{max-width:1536px}}}@media (min-width:768px){.md\:container{width:100%}@media (min-width:640px){.md\:container{max-width:640px}}@media (min-width:768px){.md\:container{max-width:768px}}@media (min-width:1024px){.md\:container{max-width:1024px}}@media (min-width:1280px){.md\:container{max-width:1280px}}@media (min-width:1536px){.md\:container{max-width:1536px}}}@media (min-width:1024px){.lg\:container{width:100%}@media (min-width:640px){.lg\:container{max-width:640px}}@media (min-width:768px){.lg\:container{max-width:768px}}@media (min-width:1024px){.lg\:container{max-width:1024px}}@media (min-width:1280px){.lg\:container{max-width:1280px}}@media (min-width:1536px){.lg\:container{max-width:1536px}}}@media (min-width:1280px){.xl\:container{width:100%}@media (min-width:640px){.xl\:container{max-width:640px}}@media (min-width:768px){.xl\:container{max-width:768px}}@media (min-width:1024px){.xl\:container{max-width:1024px}}@media (min-width:1280px){.xl\:container{max-width:1280px}}@media (min-width:1536px){.xl\:container{max-width:1536px}}}@media (min-width:1536px){.\32xl\:container{width:100%}@media (min-width:640px){.\32xl\:container{max-width:640px}}@media (min-width:768px){.\32xl\:container{max-width:768px}}@media (min-width:1024px){.\32xl\:container{max-width:1024px}}@media (min-width:1280px){.\32xl\:container{max-width:1280px}}@media (min-width:1536px){.\32xl\:container{max-width:1536px}}} | ||
/** Tool CSS content **/ |
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 |
---|---|---|
|
@@ -2,33 +2,44 @@ | |
|
||
use Fidum\NovaPackageBundler\Tests\Support\TestTool; | ||
use Laravel\Nova\Nova; | ||
|
||
use function Pest\Laravel\artisan; | ||
use function Pest\testDirectory; | ||
use function Spatie\Snapshots\assertMatchesFileSnapshot; | ||
|
||
it('finds and bundles registered scripts and styles', function () { | ||
$this->app->setBasePath(testDirectory('fixtures')); | ||
expect(public_path())->toBe('tests/fixtures'.DIRECTORY_SEPARATOR.'public'); | ||
expect(public_path())->toBe('tests'.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'public'); | ||
|
||
Nova::$tools = [TestTool::make()]; | ||
Nova::serving(function () { | ||
Nova::script('test-package', testDirectory('fixtures/input/test.js')); | ||
Nova::style('test-package', testDirectory('fixtures/input/test.css')); | ||
Nova::remoteScript('/input/public.js'); | ||
Nova::remoteStyle('/input/public.css'); | ||
Nova::remoteScript('https://unpkg.com/[email protected]/index.js'); | ||
Nova::remoteStyle('https://unpkg.com/[email protected]/dist/components.min.css'); | ||
|
||
// Files that don't exist are handled | ||
Nova::script('test-package', testDirectory('fixtures/this-doesnt-exist.js')); | ||
Nova::style('test-package', testDirectory('fixtures/input/this-doesnt-exist.css')); | ||
Nova::remoteScript('this-doesnt-exist.js'); | ||
Nova::remoteStyle('this-doesnt-exist.css'); | ||
}); | ||
|
||
artisan('nova:tools:publish') | ||
->assertSuccessful() | ||
->execute(); | ||
|
||
$script = public_path('/vendor/nova-tools/app.js'); | ||
expect($script)->toBeReadableFile(); | ||
assertMatchesFileSnapshot($script); | ||
expect($script) | ||
->toBeReadableFile() | ||
->and(file_get_contents($script)) | ||
->toMatchSnapshot(); | ||
|
||
$style = public_path('/vendor/nova-tools/app.css'); | ||
expect($style)->toBeReadableFile(); | ||
assertMatchesFileSnapshot($style); | ||
expect($style)->toBeReadableFile() | ||
->and(file_get_contents($style)) | ||
->toMatchSnapshot(); | ||
}); | ||
|
||
afterAll(function () { | ||
|
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
3 changes: 0 additions & 3 deletions
3
...hots__/files/PublishCommandTest__it_finds_and_bundles_registered_scripts_and_styles__1.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
...ots__/files/PublishCommandTest__it_finds_and_bundles_registered_scripts_and_styles__2.css
This file was deleted.
Oops, something went wrong.