Skip to content

Custom Field component does not propagate value change event #1965

@MatthewVaadin

Description

@MatthewVaadin

Problem:

In trying to test a page with a custom field component, I noticed that if I set the value of one of the fields that form part of the custom field, the value change event for the parent component is not fired. I would expect the event propagation from child components to the parent in this case.

// Custom field component
var dateRangePicker = $(DateRangePicker.class).first();
// Child component
var startTimePicker = $(DatePicker.class).first();
// This should cause a value change event on the parent custom field
test(startDatePicker).setValue(LocalDate.now());

In addition, in creating a test case for this, I noticed that the test wrapper method for a custom field component does not provide a setValue method. I would expect to be able to write something like the following:

var dateRangePicker = $(DateRangePicker.class).first();
test(dateRangePicker).setValue(new LocalDateRange(LocalDate.now(), null));

Minimal test case:

https://github.com/MatthewVaadin/custom-field-testing

Steps to reproduce:

Correct operation

  • Run application and login
  • In the Main view, set a start date in the Enrolment period field
  • Note that a log message is added below

Testing failure

  • Run the tests in MainViewTest
  • Note that directly setting the value of the DateRangePicker component adds messages to the log
  • Note that setting the value of the start or end date picker does NOT add messages to the log (tests that fail)

Metadata

Metadata

Assignees

No one assigned

    Labels

    UITestJUnit testing the UI

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions