File tree 2 files changed +26
-0
lines changed
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
21
21
/** @var string */
22
22
public $ model ;
23
23
24
+ /** @var bool */
25
+ public bool $ open = false ;
26
+
24
27
/** @var object */
25
28
public $ file ;
26
29
@@ -45,6 +48,11 @@ class CsvImporter extends Component
45
48
'columnLabels ' , 'requiredColumns ' ,
46
49
];
47
50
51
+ /** @var array */
52
+ protected $ listeners = [
53
+ 'toogle ' ,
54
+ ];
55
+
48
56
public function mount ()
49
57
{
50
58
// map and coverts the columnsToMap property into an associative array
@@ -77,6 +85,11 @@ public function import()
77
85
$ this ->emitTo ('csv-imports ' , 'imports.refresh ' );
78
86
}
79
87
88
+ public function toogle ()
89
+ {
90
+ $ this ->open = ! $ this ->open ;
91
+ }
92
+
80
93
public function render ()
81
94
{
82
95
return view (
Original file line number Diff line number Diff line change 292
292
$ this ->assertEquals (Customer::count (), 1000 );
293
293
$ this ->assertEquals ($ import ->first ()->processed_rows , 1000 );
294
294
});
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