You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using the assertAttributeDoesntContain('@xxxxxxxxxxxxxxxxxxx', 'class', 'completed') function, it asserts as false on objects without any class attributes. But in this case the expected behaviour in my opinion should be that it asserts as true when that attribute is missing. The specific value completed is missing on this elements attribute class when the attribute is missing entirely.
This behaviour would accomodate dynamic changes of classes on objects. For instance, when classes are added using javascript. When an object has no class, the class attribute will be missing. When a class is added, the class attribute itself is added as well.
Currently there are a number of functions for assertAttribute:
assertAttribute: checks if an attribute is found in the element and whether it's actual value is the same as the expected value
assertAttributeMissing (currently undocumented): Assert that the element matching the given selector is missing the provided attribute.
assertAttributeContains: Assert that the element matching the given selector contains the given value in the provided attribute.
assertAttributeDoesntContain: Assert that the element matching the given selector does not contain the given value in the provided attribute.
The last one however, also effectively evaluates whether the attribute is present. If it is missing, it also does not contain the value. But it evaluates as false when the attribute is missing. Imo, this is not expected behaviour.
assertAttributeMissing should check if the attribute is there, if not then ok.
assertAttributeDoesntContain should check if the attribute does not contain a value and is also satisfied if the attribute is not there at all.
the following asserts would fail with Did not see expected attribute [class] within element [...]. Failed asserting that null is not null.
it('shows the todo list with item completed', function () {
$this->browse(function (Browser$browser) {
$browser->assertSee('To Do List')
->assertAttributeDoesntContain('#todolist-item1', 'class', 'completed')
});
});
The text was updated successfully, but these errors were encountered:
Dusk Version
8.2.11
Laravel Version
11.32.0
PHP Version
8.3.14
PHPUnit Version
11.4.3
Database Driver & Version
Not applicable
Description
While using the
assertAttributeDoesntContain('@xxxxxxxxxxxxxxxxxxx', 'class', 'completed')
function, it asserts as false on objects without any class attributes. But in this case the expected behaviour in my opinion should be that it asserts as true when that attribute is missing. The specific valuecompleted
is missing on this elements attributeclass
when the attribute is missing entirely.This behaviour would accomodate dynamic changes of classes on objects. For instance, when classes are added using javascript. When an object has no class, the class attribute will be missing. When a class is added, the class attribute itself is added as well.
Currently there are a number of functions for assertAttribute:
The last one however, also effectively evaluates whether the attribute is present. If it is missing, it also does not contain the value. But it evaluates as false when the attribute is missing. Imo, this is not expected behaviour.
Steps To Reproduce
Given this html content:
the following asserts would fail with
Did not see expected attribute [class] within element [...]. Failed asserting that null is not null.
The text was updated successfully, but these errors were encountered: