File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ class CsvImporter extends Component
2121 /** @var string */
2222 public $ model ;
2323
24+ /** @var bool */
25+ public bool $ open = false ;
26+
2427 /** @var object */
2528 public $ file ;
2629
@@ -45,6 +48,11 @@ class CsvImporter extends Component
4548 'columnLabels ' , 'requiredColumns ' ,
4649 ];
4750
51+ /** @var array */
52+ protected $ listeners = [
53+ 'toogle ' ,
54+ ];
55+
4856 public function mount ()
4957 {
5058 // map and coverts the columnsToMap property into an associative array
@@ -77,6 +85,11 @@ public function import()
7785 $ this ->emitTo ('csv-imports ' , 'imports.refresh ' );
7886 }
7987
88+ public function toogle ()
89+ {
90+ $ this ->open = ! $ this ->open ;
91+ }
92+
8093 public function render ()
8194 {
8295 return view (
Original file line number Diff line number Diff line change 292292 $ this ->assertEquals (Customer::count (), 1000 );
293293 $ this ->assertEquals ($ import ->first ()->processed_rows , 1000 );
294294});
295+
296+ it ('toogles import button ' , function () {
297+ $ this ->actingAs (User::factory ()->create ());
298+
299+ $ model = Customer::class;
300+
301+ livewire (CsvImporter::class, [
302+ 'model ' => $ model
303+ ])
304+ ->emit ('toogle ' )
305+ ->assertSet ('open ' , true )
306+ ->assertHasNoErrors ();
307+ });
You can’t perform that action at this time.
0 commit comments