Skip to content

Commit

Permalink
Add data-event-id="$xxx" attributes to timeline items for easy select…
Browse files Browse the repository at this point in the history
…ing in tests

Split out from #653

Example test assertions: https://github.com/matrix-org/matrix-public-archive/blob/db6d3797d74104ad7c93e572ed106f1a685a90d0/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.*`)
);
```
  • Loading branch information
MadLittleMods committed Feb 25, 2022
1 parent 460780d commit a6e3e3a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/platform/web/ui/session/room/timeline/BaseMessageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ export class BaseMessageView extends TemplateView {
if (this._interactive) {
children.push(t.button({className: "Timeline_messageOptions"}, "⋯"));
}
const li = t.el(this._tagName, {className: {
"Timeline_message": true,
own: vm.isOwn,
unsent: vm.isUnsent,
unverified: vm.isUnverified,
disabled: !this._interactive,
continuation: vm => vm.isContinuation,
}}, children);
const li = t.el(this._tagName, {
className: {
"Timeline_message": true,
own: vm.isOwn,
unsent: vm.isUnsent,
unverified: vm.isUnverified,
disabled: !this._interactive,
continuation: vm => vm.isContinuation,
},
'data-event-id': vm.eventId
}, children);
// given that there can be many tiles, we don't add
// unneeded DOM nodes in case of a continuation, and we add it
// with a side-effect binding to not have to create sub views,
Expand Down

0 comments on commit a6e3e3a

Please sign in to comment.