generated from spatie/package-skeleton-laravel
-
-
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.
lwb-18 Implement h5 sections component
- Loading branch information
Showing
4 changed files
with
172 additions
and
0 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,3 @@ | ||
<h5 {!! $globalAttributes !!}> | ||
{{ $slot }} | ||
</h5> |
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,41 @@ | ||
<?php | ||
|
||
namespace T73biz\LwBits\Components\Sections; | ||
|
||
use Illuminate\Contracts\Foundation\Application as ContractedApplication; | ||
use Illuminate\Contracts\View\Factory; | ||
use Illuminate\Contracts\View\View as ContractedView; | ||
use Illuminate\Foundation\Application; | ||
use Illuminate\View\View; | ||
use Livewire\Component; | ||
use T73biz\LwBits\Components\GlobalAttributesTrait; | ||
|
||
/** | ||
* Class H5 | ||
*/ | ||
class H5 extends Component | ||
{ | ||
use GlobalAttributesTrait; | ||
|
||
/** | ||
* Standard mount function | ||
*/ | ||
public function mount(): void | ||
{ | ||
$this->setGlobalAttributes(); | ||
} | ||
|
||
/** | ||
* Standard render function | ||
*/ | ||
public function render(): Application|ContractedApplication|ContractedView|Factory|View | ||
{ | ||
return view( | ||
'lw-bits::sections.h5', | ||
[ | ||
'globalAttributes' => $this->getGlobalAttributes(), | ||
'slot' => '', | ||
] | ||
); | ||
} | ||
} |
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,119 @@ | ||
<?php | ||
|
||
use Livewire\Livewire; | ||
use T73biz\LwBits\Tests\TestSupport\Components\Sections\MyH5; | ||
|
||
it('can render', function () { | ||
Livewire::test(MyH5::class) | ||
->assertStatus(200); | ||
}); | ||
|
||
it('can render with accesskey', function () { | ||
Livewire::test(MyH5::class, ['accessKey' => true]) | ||
->assertSee('accesskey'); | ||
}); | ||
|
||
it('can render with autocapitalize', function () { | ||
Livewire::test(MyH5::class, ['autoCapitalize' => true]) | ||
->assertSee('autocapitalize'); | ||
}); | ||
|
||
it('can render with autofocus', function () { | ||
Livewire::test(MyH5::class, ['autoFocus' => true]) | ||
->assertSee('autofocus'); | ||
}); | ||
|
||
it('can render with contenteditable', function () { | ||
Livewire::test(MyH5::class, ['contentEditable' => true]) | ||
->assertSee('contenteditable'); | ||
}); | ||
|
||
it('can render with css classes', function () { | ||
Livewire::test(MyH5::class, ['cssClasses' => ['class1', 'class2']]) | ||
->assertSee('class="class1 class2"', false); | ||
}); | ||
|
||
it('can render with data-*', function () { | ||
Livewire::test(MyH5::class, ['data' => ['name' => 'main-h5']]) | ||
->assertSee('data-name="main-h5"', false); | ||
}); | ||
|
||
it('can render with dir', function () { | ||
Livewire::test(MyH5::class, ['direction' => 'rtl']) | ||
->assertSee('dir="rtl"', false); | ||
}); | ||
|
||
it('can render with draggable', function () { | ||
Livewire::test(MyH5::class, ['draggable' => true]) | ||
->assertSee('draggable'); | ||
}); | ||
|
||
it('can render with enterkeyhint', function () { | ||
Livewire::test(MyH5::class, ['enterKeyHint' => 'enter']) | ||
->assertSee('enterkeyhint="enter"', false); | ||
}); | ||
|
||
it('can render with hidden', function () { | ||
Livewire::test(MyH5::class, ['hidden' => true]) | ||
->assertSee('hidden'); | ||
}); | ||
|
||
it('can render with id', function () { | ||
Livewire::test(MyH5::class, ['id' => 'main-h5']) | ||
->assertSee('id="main-h5"', false); | ||
}); | ||
|
||
it('can render with language', function () { | ||
Livewire::test(MyH5::class, ['language' => 'en']) | ||
->assertSee('lang="en"', false); | ||
}); | ||
|
||
it('can render with nonce', function () { | ||
Livewire::test(MyH5::class, ['nonce' => 'abc123']) | ||
->assertSee('nonce="abc123"', false); | ||
}); | ||
|
||
it('can render with parts', function () { | ||
Livewire::test(MyH5::class, ['parts' => ['part1', 'part2']]) | ||
->assertSee('part="part1 part2"', false); | ||
}); | ||
|
||
it('can render with popOver', function () { | ||
Livewire::test(MyH5::class, ['popOver' => true]) | ||
->assertSee('popover'); | ||
}); | ||
|
||
it('can render with role', function () { | ||
Livewire::test(MyH5::class, ['role' => 'main']) | ||
->assertSee('role="main"', false); | ||
}); | ||
|
||
it('can render with slot', function () { | ||
Livewire::test(MyH5::class, ['slotAttribute' => 'main-h5']) | ||
->assertSee('slot="main-h5"', false); | ||
}); | ||
|
||
it('can render with spellcheck', function () { | ||
Livewire::test(MyH5::class, ['spellCheck' => true]) | ||
->assertSee('spellcheck'); | ||
}); | ||
|
||
it('can render with styles', function () { | ||
Livewire::test(MyH5::class, ['styles' => ['color' => 'red', 'font-size' => '16px']]) | ||
->assertSee('style="color:red;font-size:16px"', false); | ||
}); | ||
|
||
it('can render with tabindex', function () { | ||
Livewire::test(MyH5::class, ['tabIndex' => 1]) | ||
->assertSee('tabindex="1"', false); | ||
}); | ||
|
||
it('can render with title', function () { | ||
Livewire::test(MyH5::class, ['title' => 'main-h5']) | ||
->assertSee('title="main-h5"', false); | ||
}); | ||
|
||
it('can render with translate', function () { | ||
Livewire::test(MyH5::class, ['translate' => true]) | ||
->assertSee('translate'); | ||
}); |
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,9 @@ | ||
<?php | ||
|
||
namespace T73biz\LwBits\Tests\TestSupport\Components\Sections; | ||
|
||
use T73biz\LwBits\Components\Sections\H5; | ||
|
||
class MyH5 extends H5 | ||
{ | ||
} |