Fixed error dispatching
This commit is contained in:
@@ -26,7 +26,7 @@ class LivewireColumnChart extends Component
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->emit($onColumnClickEventName, $column);
|
$this->dispatch($onColumnClickEventName, $column);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|||||||
@@ -22,4 +22,23 @@ class LivewireColumnChartTest extends TestCase
|
|||||||
//Assert
|
//Assert
|
||||||
$this->assertNotNull($component);
|
$this->assertNotNull($component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function should_emit_event_if_present()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
$component = $this->buildComponent();
|
||||||
|
|
||||||
|
$columnChartModel = $component->columnChartModel;
|
||||||
|
|
||||||
|
data_set($columnChartModel, 'onColumnClickEventName', 'custom-event');
|
||||||
|
|
||||||
|
$component->set('columnChartModel', $columnChartModel);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
$component->runAction('onColumnClick', []);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
$component->assertDispatched('custom-event');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user