Grid with TimePicker Unit test - Branched from 186582

Thank you for your reply. 


Unfortunately, we are not just unit testing TimePicker only. The timepicker components are a part Grid since we use it under GridEditSettings and two different events are triggered depending on the id. The code is added in below. We would like to know if there is a way to call these events by Change() method or other method in unit test?

 

<code>


<SfGrid @ref="@Grid" DataSource="@Data" AllowSelection="true">

    <GridEvents TValue="OfficeHoursVM" OnActionBegin="ActionBegin" OnActionComplete="ActionComplete"

                RowSelected="RowSelected" RowDeselected="RowDeselected" RowDataBound="RowDataBound"></GridEvents>

    <GridSelectionSettings CheckboxOnly="true"></GridSelectionSettings>

    <GridEditSettings AllowEditing="true" Mode="EditMode.Dialog">

        <HeaderTemplate>Edit Hours</HeaderTemplate>

        <Template>

            @{

                var item = (context as OfficeHoursVM);

                    <div class="edit-dialog">

                        <SfTimePicker ID="OpenTime"

                            TValue="TimeOnly"

                            @bind-Value="@item.OpenTime"

                            Placeholder="Open Time"

                            Enabled="@item.Open"

                            FloatLabelType="Syncfusion.Blazor.Inputs.FloatLabelType.Auto">

                            <TimePickerEvents TValue="TimeOnly" ValueChange="@(e => onStartTimeChange(item.Open, item.CloseTime, e))"></TimePickerEvents>

                        </SfTimePicker>


                        <SfTimePicker ID="CloseTime"

                            TValue="TimeOnly"

                            @bind-Value="@item.CloseTime"

                            Placeholder="Close Time"

                            Enabled="@item.Open"

                            FloatLabelType="Syncfusion.Blazor.Inputs.FloatLabelType.Auto">

                            <TimePickerEvents TValue="TimeOnly" ValueChange="@(e => onCloseTimeChange(item.Open, item.OpenTime, e))"></TimePickerEvents>

                        </SfTimePicker>


                        <SfCheckBox ID="Open" @bind-Checked="@item.Open" Label="Office Open" @onchange="@(e => onOpenChange(item.OpenTime, item.CloseTime, e))"></SfCheckBox>

                        <div>

                            <label id="UpdateErrorMessage" class="validation-message">@OfficeHoursUpdateErrorMessage</label>

                        </div>

                    </div>

            }

        </Template>

...


</code>

Thank you.


1 Reply

MS Monisha Saravanan Syncfusion Team February 19, 2024 01:36 PM UTC


Hi Tristan Kim,


Greetings from Syncfusion.


We suspect that you are expecting to trigger the valuechange event of the components (TimePicker) used inside the Edit template feature of DataGrid. If so, we would like to inform you that it is not possible to trigger the value change event of the components rendered inside the templates programmatically.


Kindly get back to us if we misunderstood your query or if you have further queries.


Regards,

Monisha


Loader.
Up arrow icon