Skip to content
Snippets Groups Projects
Unverified Commit 809ad58f authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3181634 by Wongjn: States API: Empty/Filled state with number <input>...

Issue #3181634 by Wongjn: States API: Empty/Filled state with number <input> does not update when using spinner
parent 5ca9f5d8
No related branches found
No related tags found
16 merge requests!8394[warning] array_flip(): Can only flip STRING and INTEGER values, when saving a non-revisionable custom content entity,!7780issue 3443822: fix for 'No route found for the specified format html. Supported formats: json, xml.',!5013Issue #3071143: Table Render Array Example Is Incorrect,!4848Issue #1566662: Update module should send notifications on Thursdays,!4792Issue #2230689: Remove redundant "Italic" style,!4220Issue #3368223: Link field > Access to internal links is not checked on display.,!3884Issue #3356842,!3870Issue #3087868,!3812Draft: Issue #3339373 by alexpott, andypost, mondrake:...,!3686Issue #3219967 against 9.5.x,!3683Issue #2939397: Clearing AliasManager cache with root path raises warning,!3543Issue #3344259: Allow ajax dialog to have focus configurable,!2205Quote all names in the regions section.,!1459Issue #3087632: menu_name max length is too long,!866Issue #2845319: The highlighting of the 'Home' menu-link does not respect query strings and fragment identifiers,!204Issue #3040556: It is not possible to react to an entity being duplicated
......@@ -526,6 +526,10 @@
// the state.
return this.val() === '';
},
// Listen to 'change' for number native "spinner" widgets.
change() {
return this.val() === '';
},
},
checked: {
......
......@@ -217,6 +217,9 @@
empty: {
keyup: function keyup() {
return this.val() === '';
},
change: function change() {
return this.val() === '';
}
},
checked: {
......
......@@ -106,6 +106,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#empty_value' => '_none',
'#empty_option' => '- None -',
];
$form['number_trigger'] = [
'#type' => 'number',
'#title' => 'Number trigger',
];
// Tested fields.
// Checkbox trigger.
......@@ -374,6 +378,17 @@ public function buildForm(array $form, FormStateInterface $form_state) {
],
];
// Number triggers.
$form['item_visible_when_number_trigger_filled_by_spinner'] = [
'#type' => 'item',
'#title' => 'Item visible when number trigger filled by spinner widget',
'#states' => [
'visible' => [
':input[name="number_trigger"]' => ['filled' => TRUE],
],
],
];
$form['select'] = [
'#type' => 'select',
'#title' => 'select 1',
......
......@@ -21,4 +21,28 @@ module.exports = {
.waitForElementNotVisible('input[name="textfield"]', 1000)
.assert.noDeprecationErrors();
},
'Test number trigger with spinner widget': (browser) => {
browser
.drupalRelativeURL('/form-test/javascript-states-form')
.waitForElementVisible('body', 1000)
.waitForElementNotVisible(
'#edit-item-visible-when-number-trigger-filled-by-spinner',
1000,
)
.execute(
// eslint-disable-next-line func-names, prefer-arrow-callback, no-shadow
function () {
// Emulate usage of the spinner browser widget on number inputs
// on modern browsers.
const numberTrigger = document.getElementById('edit-number-trigger');
numberTrigger.value = 1;
numberTrigger.dispatchEvent(new Event('change'));
},
);
browser.waitForElementVisible(
'#edit-item-visible-when-number-trigger-filled-by-spinner',
1000,
);
},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment