Skip to content
Snippets Groups Projects

Issues/3010895: Empty state is wrong for input when filled with whitespaces.

Open AKHIL BABU requested to merge issue/drupal-3010895:3010895-empty-state-is into 11.x
3 unresolved threads

Closes #3010895

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
535 535 keyup() {
536 536 // The function associated with that trigger returns the new value for
537 537 // the state.
538 return this.val() === '';
538 return (
539 this.val().replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, '') === ''
540 );
539 541 },
540 542 // Listen to 'change' for number native "spinner" widgets.
541 543 change() {
542 return this.val() === '';
544 return (
545 this.val().replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, '') === ''
  • Aman Mansuri added 1 commit

    added 1 commit

    • 1c2166da - removing duplicacy of regex with a variable

    Compare with previous version

  • Aman Mansuri added 1 commit

    added 1 commit

    • dc442bdc - change in variable type to fix pipline issue

    Compare with previous version

  • Aman Mansuri added 1 commit

    added 1 commit

    Compare with previous version

  • quietone
  • 528 528 * @prop value
    529 529 * @prop collapsed
    530 530 */
    531 const blankSpaceExp = /^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g;
    • As a regex this should have a comment to explain what the purpose is. And the name, 'blankSpaceExp', should be descriptive of what this does. I know what this is doing and I have yet to figure out what 'blankSpaceExp' means.

      The list of characters here is different than the trim function in PHP. In #32 it was asked that these are consistent.

    • Please register or sign in to reply
  • quietone
  • 348 348 $this->assertEquals('required', $textfield_required_target->getAttribute('required'));
    349 349 $this->assertTrue($details->hasAttribute('open'));
    350 350 $this->assertTrue($textfield_in_details->isVisible());
    351
    352 // Add a whitespace to the textfield and ensure that 'filled' state is
    353 // not triggered.
    354 $trigger->setValue(' ');
    Please register or sign in to reply
    Loading