Skip to content

Commit

Permalink
fix dots in attribute names
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 16, 2020
1 parent ec75487 commit 2d1d962
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/View/DynamicComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(string $component)
public function render()
{
$template = <<<'EOF'
<?php extract(collect($attributes->getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel(str_replace(':', ' ', $key)) => $value]; })->all(), EXTR_SKIP); ?>
<?php extract(collect($attributes->getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel(str_replace([':', '.'], ' ', $key)) => $value]; })->all(), EXTR_SKIP); ?>
{{ props }}
<x-{{ component }} {{ bindings }} {{ attributes }}>
{{ slots }}
Expand Down Expand Up @@ -113,7 +113,7 @@ protected function compileProps(array $bindings)
protected function compileBindings(array $bindings)
{
return collect($bindings)->map(function ($key) {
return ':'.$key.'="$'.Str::camel(str_replace(':', ' ', $key)).'"';
return ':'.$key.'="$'.Str::camel(str_replace([':', '.'], ' ', $key)).'"';
})->implode(' ');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/View/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function test_rendering_a_dynamic_component()
{
$view = View::make('uses-panel-dynamically', ['name' => 'Taylor'])->render();

$this->assertEquals('<div class="ml-2" wire:model="foo">
$this->assertEquals('<div class="ml-2" wire:model="foo" wire:model.lazy="bar">
Hello Taylor
</div>', trim($view));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<x-dynamic-component component="panel" class="ml-2" :name="$name" wire:model="foo">
<x-dynamic-component component="panel" class="ml-2" :name="$name" wire:model="foo" wire:model.lazy="bar">
Panel contents
</x-dynamic-component>

0 comments on commit 2d1d962

Please sign in to comment.