Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions tests/View/Blade/BladeComponentTagCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ public function testClassNamesCanBeGuessed()
{
$container = new Container;
$container->instance(Application::class, $app = m::mock(Application::class));
$container->instance(Factory::class, $factory = m::mock(Factory::class));
$app->shouldReceive('getNamespace')->once()->andReturn('App\\');
Container::setInstance($container);

Expand All @@ -392,6 +393,7 @@ public function testClassNamesCanBeGuessedWithNamespaces()
{
$container = new Container;
$container->instance(Application::class, $app = m::mock(Application::class));
$container->instance(Factory::class, $factory = m::mock(Factory::class));
$app->shouldReceive('getNamespace')->once()->andReturn('App\\');
Container::setInstance($container);

Expand Down Expand Up @@ -570,8 +572,8 @@ public function testPackagesClasslessComponents()
$container = new Container;
$container->instance(Application::class, $app = m::mock(Application::class));
$container->instance(Factory::class, $factory = m::mock(Factory::class));
$app->shouldReceive('getNamespace')->andReturn('App\\');
$factory->shouldReceive('exists')->andReturn(true);
$app->shouldReceive('getNamespace')->once()->andReturn('App\\');
$factory->shouldReceive('exists')->once()->andReturn(true);
Container::setInstance($container);

$result = $this->compiler()->compileTags('<x-package::anonymous-component :name="\'Taylor\'" :age="31" wire:model="foo" />');
Expand Down Expand Up @@ -915,6 +917,18 @@ public function testOriginalAttributesAreRestoredAfterRenderingChildComponentWit
$this->assertSame($attributes->get('other'), 'ok');
}

public function testTransitionAttributeIsHandledCorrectly()
{
$this->mockViewFactory();
$result = $this->compiler(['test' => TestTransitionComponent::class])
->compileTags('<x-test x-transition>content</x-test>');

$this->assertStringContainsString(
"'x-transition' => true",
$result
);
}

protected function mockViewFactory($existsSucceeds = true)
{
$container = new Container;
Expand Down
13 changes: 13 additions & 0 deletions tests/View/Blade/Components/TestTransitionComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Illuminate\Tests\View\Blade\Components;

use Illuminate\View\Component;

class TestTransitionComponent extends Component
{
public function render()
{
return '<div {{ $attributes }}>{{ $slot }}</div>';
}
}