|
2 | 2 |
|
3 | 3 | use Aerni\LivewireForms\Facades\ViewManager; |
4 | 4 |
|
5 | | -it('can get the path of a view', function () { |
6 | | - config()->set('livewire-forms.view_path', 'my/custom/path'); |
| 5 | +it('resolves view path relative to Livewire view path', function () { |
| 6 | + expect(ViewManager::viewPath('view'))->toBe('livewire/forms/view'); |
| 7 | +}); |
| 8 | + |
| 9 | +it('resolves view path with custom Livewire view path', function () { |
| 10 | + config()->set('livewire.view_path', resource_path('views/wire')); |
| 11 | + |
| 12 | + expect(ViewManager::viewPath('view'))->toBe('wire/forms/view'); |
| 13 | +}); |
7 | 14 |
|
8 | | - expect(ViewManager::viewPath('view'))->toBe('my/custom/path/view'); |
| 15 | +it('resolves view path with custom forms view path', function () { |
| 16 | + config()->set('livewire-forms.view_path', 'custom'); |
| 17 | + |
| 18 | + expect(ViewManager::viewPath('view'))->toBe('livewire/custom/view'); |
| 19 | +}); |
| 20 | + |
| 21 | +it('resolves view path without a view', function () { |
| 22 | + expect(ViewManager::viewPath())->toBe('livewire/forms'); |
| 23 | +}); |
| 24 | + |
| 25 | +it('resolves absolute view path', function () { |
| 26 | + expect(ViewManager::absoluteViewPath()) |
| 27 | + ->toBe(resource_path('views/livewire/forms')); |
| 28 | +}); |
| 29 | + |
| 30 | +it('resolves absolute view path with a subpath', function () { |
| 31 | + expect(ViewManager::absoluteViewPath('default')) |
| 32 | + ->toBe(resource_path('views/livewire/forms/default')); |
| 33 | +}); |
| 34 | + |
| 35 | +it('resolves absolute view path with custom Livewire view path', function () { |
| 36 | + config()->set('livewire.view_path', resource_path('views/wire')); |
| 37 | + |
| 38 | + expect(ViewManager::absoluteViewPath('default')) |
| 39 | + ->toBe(resource_path('views/wire/forms/default')); |
9 | 40 | }); |
10 | 41 |
|
11 | 42 | it('can get the default view', function () { |
|
29 | 60 | expect(ViewManager::themeViewExists('default', 'fields.default'))->toBeTrue(); |
30 | 61 | expect(ViewManager::themeViewExists('default', 'fields.nope'))->toBeFalse(); |
31 | 62 | }); |
32 | | - |
33 | | -// it('can check if a theme exists', function () { |
34 | | -// expect(ViewManager::themeExists('default'))->toBeTrue(); |
35 | | -// expect(ViewManager::themeExists('nope'))->toBeFalse(); |
36 | | -// }); |
|
0 commit comments