If the attribute already exists, the new value will be appended to the existing value with space as the delimiter.
In case a different delimiter is necessary, it's possible to change it by adding a delimiter property. Example:
addAttribute: {selector: 'body', attribute: {name: 'data-controller', value: 'another'}, delimiter: ', ' }
Usage
In a visual test scenario add:
addAttribute: {selector: 'body', attribute: {name: 'class', value: 'my-class'}}
Adding more than one attribute is possible by using an array:
If the attribute already exists, the new value will be appended to the existing value with space as the delimiter. In case a different delimiter is necessary, it's possible to change it by adding a
delimiter
property. Example:addAttribute: {selector: 'body', attribute: {name: 'data-controller', value: 'another'}, delimiter: ', ' }