Please refer to the documentation about testing. It gives you everything you need to know:
Jan 30, 2024
3
Level 2
Livewire testing
I have a blade file and it has a livewire component.
@section('content')
<div class="subheader">
<h1 class="subheader-title"><i
class='subheader-icon fal fa-pen'></i> {{__('Feedback Entry')}}</span></h1>
</div>
<div class="row sticky-top">
<div class="col-sm-12 col-xl-12">
<div class="p-3 bg-success-600 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-10 d-block l-h-n m-0 fw-500">
{{$feedback->subject_id ?? ''}} - {{$feedback->subject->course_name ?? ''}}
<small class="m-0 l-h-n">{{__('Course Name')}}</small>
</h3>
</div>
<i class="fal fa-book-open position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4"
style="font-size: 6rem;"></i>
</div>
</div>
<div class="col-sm-6 col-xl-6">
<div class="p-3 bg-info-600 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-10 d-block l-h-n m-0 fw-500">
{{$feedback->student_id ?? ''}} - {{$feedback->student->name_en ?? ''}}
<small class="m-0 l-h-n">{{__('Student Name')}}</small>
</h3>
</div>
<i class="fal fa-school position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4"
style="font-size: 6rem;"></i>
</div>
</div>
<div class="col-sm-6 col-xl-6">
<div class="p-3 bg-warning-700 rounded overflow-hidden position-relative text-white mb-g">
<div class="">
<h3 class="display-10 d-block l-h-n m-0 fw-500">
{{$feedback->teacher->name_en ?? ''}}
<small class="m-0 l-h-n">{{__('Teacher Name')}}</small>
</h3>
</div>
<i class="fal fa-chalkboard-teacher position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4"
style="font-size: 6rem;"></i>
</div>
</div>
</div>
<div id="panel-2" class="panel">
<div class="panel-container show">
<div class="panel-content">
<div class="demo-v-spacing">
@livewire('student-feed-back-entry',['feedbackInformation' => $feedback])
</div>
</div>
</div>
</div>
@endsection
I planning to write a LiveWire test. I created the basic test file and working fine. But i want to know how to write test for sending data from blade to livewire that and also livewire concepts.
Please or to participate in this conversation.