forked from mystiq/hydrogen-web
Add data-event-id="$xxx" attributes to timeline items for easy selecting in tests
Split out from https://github.com/vector-im/hydrogen-web/pull/653
Example test assertions: db6d3797d7/test/e2e-tests.js (L248-L252)
```js
// Make sure the $abc event on the page has "foobarbaz" text in it
assert.match(
dom.document.querySelector(`[data-event-id="$abc"]`).outerHTML,
new RegExp(`.*foobarbaz.*`)
);
```
This commit is contained in:
parent
460780d602
commit
a6e3e3a7b4
1 changed files with 11 additions and 8 deletions
|
@ -40,14 +40,17 @@ export class BaseMessageView extends TemplateView {
|
||||||
if (this._interactive) {
|
if (this._interactive) {
|
||||||
children.push(t.button({className: "Timeline_messageOptions"}, "⋯"));
|
children.push(t.button({className: "Timeline_messageOptions"}, "⋯"));
|
||||||
}
|
}
|
||||||
const li = t.el(this._tagName, {className: {
|
const li = t.el(this._tagName, {
|
||||||
"Timeline_message": true,
|
className: {
|
||||||
own: vm.isOwn,
|
"Timeline_message": true,
|
||||||
unsent: vm.isUnsent,
|
own: vm.isOwn,
|
||||||
unverified: vm.isUnverified,
|
unsent: vm.isUnsent,
|
||||||
disabled: !this._interactive,
|
unverified: vm.isUnverified,
|
||||||
continuation: vm => vm.isContinuation,
|
disabled: !this._interactive,
|
||||||
}}, children);
|
continuation: vm => vm.isContinuation,
|
||||||
|
},
|
||||||
|
'data-event-id': vm.eventId
|
||||||
|
}, children);
|
||||||
// given that there can be many tiles, we don't add
|
// given that there can be many tiles, we don't add
|
||||||
// unneeded DOM nodes in case of a continuation, and we add it
|
// unneeded DOM nodes in case of a continuation, and we add it
|
||||||
// with a side-effect binding to not have to create sub views,
|
// with a side-effect binding to not have to create sub views,
|
||||||
|
|
Loading…
Reference in a new issue