Problem/Motivation

Currently, if we want to test if an HTML-Elements Attribute NOT exists we need to test it via

$this->assertSession->elementNotExists('css', '#testId[myAttribute]');

(Using BrowserTestBase for example)

Steps to reproduce

Proposed resolution

Implement elementAttributeNotExists in \Drupal\Tests\WebAssert.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3252304

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Grevil created an issue. See original summary.

anybody’s picture

See Mink issue here: https://github.com/minkphp/Mink/pull/709 would make sense to implement this upstream, wouldn't it?

Agree with @Grevil that it would be expected and comfortable to have that functionality.

murilohp’s picture

Assigned: Unassigned » murilohp
murilohp’s picture

@anybody, that was a great suggestion, the only problem with the PR https://github.com/minkphp/Mink/pull/709 was, it was opened, closed but never merged, then I created a new issue: https://github.com/minkphp/Mink/issues/816 to track this situation, and fortunately, this new issue was merged!

I'll keep the assign to me, and I'll wait for a new release of mink, when it's done, I can update the .lock with the elementAttributeNotExists.

anybody’s picture

Whaooo that's very very cool @murilohp thank you !! :)

grevil’s picture

Very nice, appreciate it @murilohp!

murilohp’s picture

Assigned: murilohp » Unassigned
Status: Active » Needs review

A new version of mink landed! See #3264903: Switch from friends-of-behat/mink back to behat/mink once it's Symfony 6 compatible, now we can implement elementAttributeNotExists in WebAssert.php.

smustgrave’s picture

Status: Needs review » Needs work

MR needs to be updated for 10.1

+1 for this though

grevil’s picture

Version: 10.0.x-dev » 10.1.x-dev

Must've gone under in my inbox! Thanks for implementing this @murilohp!

grevil’s picture

I can rebase it for 10.0.x, but @murilohp needs to set the MRs target branch to 10.1.x :)

grevil’s picture

Status: Needs work » Closed (works as designed)

Alright guys, this issue is actually already fixed in 10.1.x!!

WebAssert now directly extends "Behat\Mink\WebAssert" in 10.1.x, where elementAttributeNotExists is already implemented! :)

See https://github.com/minkphp/Mink/blob/19e58905632e7cfdc5b2bafb9b950a3521a...

Closing this! Sorry for not reviewing this earlier @murilohp!