-
-
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.
Merge pull request #15 from gwleuverink/feature/initable-exports
Feature/initable exports
- Loading branch information
Showing
17 changed files
with
1,582 additions
and
659 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
ba11d6aba92e038053ced776acbea2162480bced |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,73 @@ | ||
<?php | ||
|
||
namespace Leuverink\Bundle\Tests\Browser; | ||
|
||
use Leuverink\Bundle\BundleManager; | ||
use Leuverink\Bundle\Tests\DuskTestCase; | ||
|
||
// Pest & Workbench Dusk don't play nicely together | ||
// We need to fall back to PHPUnit syntax. | ||
|
||
class InitableImportsTest extends DuskTestCase | ||
{ | ||
/** @test */ | ||
public function it_invokes_imports_with_init_prop() | ||
{ | ||
$this->blade(<<< 'HTML' | ||
<x-import module="~/default-function" init /> | ||
HTML) | ||
->assertScript('window.test_evaluated', true); | ||
} | ||
|
||
/** @test */ | ||
public function it_doesnt_invoke_imports_without_init_prop() | ||
{ | ||
$this->blade(<<< 'HTML' | ||
<x-import module="~/default-function" /> | ||
HTML) | ||
->assertScript('window.test_evaluated', null); | ||
} | ||
|
||
/** @test */ | ||
public function it_still_registers_an_aliased_module_when_the_default_export_is_invoked() | ||
{ | ||
$this->markTestIncomplete('TODO: Priority!'); | ||
} | ||
|
||
/** @test */ | ||
public function it_appends_init_to_the_bundle_filename_when_import_is_invoked() | ||
{ | ||
$bundle = BundleManager::new()->bundle(<<< 'JS' | ||
alert('Hello World!') | ||
JS, ['init' => true]); | ||
|
||
expect($bundle)->getFilename()->toContain('init'); | ||
} | ||
|
||
/** @test */ | ||
public function it_doesnt_append_init_to_the_bundle_filename_when_import_is_not_invoked() | ||
{ | ||
$bundle = BundleManager::new()->bundle(<<< 'JS' | ||
alert('Hello World!') | ||
JS); | ||
|
||
expect($bundle)->getFilename()->not->toContain('init'); | ||
} | ||
|
||
/** @test */ | ||
public function it_raises_a_console_error_when_invokable_import_is_not_a_function() | ||
{ | ||
$this->markTestIncomplete("can't inspect console for thrown errors"); | ||
|
||
// $this->blade(<<< 'HTML' | ||
// <x-import module="~/default-object" /> | ||
// HTML) | ||
// ->assertScript('window.test_evaluated', null); | ||
} | ||
|
||
/** @test */ | ||
public function it_raises_a_console_error_when_invokable_import_is_not_javascript_file() | ||
{ | ||
$this->markTestIncomplete("can't inspect console for thrown errors"); | ||
} | ||
} |
Oops, something went wrong.