Added regression tests for Natural headers
parent
cea5421660
commit
2ad0032f72
|
@ -264,33 +264,6 @@ describe('MessagePanel', function() {
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create a few redacted events
|
|
||||||
//isRedacted just checks the redacted_because
|
|
||||||
function mkRedactionEvents() {
|
|
||||||
const events = [];
|
|
||||||
const ts0 = Date.now();
|
|
||||||
let i=0
|
|
||||||
|
|
||||||
let redaction = test_utils.mkEvent({
|
|
||||||
type: "m.room.redaction",
|
|
||||||
event: true, room: "!room:id", user: "@user:id", ts: ts0 + ++i * 1000 ,
|
|
||||||
content: {},
|
|
||||||
});
|
|
||||||
let event =test_utils.mkRedactedEvent({
|
|
||||||
type: "m.room.message",
|
|
||||||
event: true, room: "!room:id", user: "@user:id",
|
|
||||||
ts: ts0 + i * 1000 ,
|
|
||||||
// redacted_because: redaction This is not working at the moment
|
|
||||||
})
|
|
||||||
redaction.redacts = event.event_id;
|
|
||||||
|
|
||||||
events.push(event);
|
|
||||||
events.push(redaction);
|
|
||||||
|
|
||||||
return events;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function isReadMarkerVisible(rmContainer) {
|
function isReadMarkerVisible(rmContainer) {
|
||||||
return rmContainer && rmContainer.children.length > 0;
|
return rmContainer && rmContainer.children.length > 0;
|
||||||
|
@ -493,19 +466,4 @@ describe('MessagePanel', function() {
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should render only one Date separator for redacted events', function () {
|
|
||||||
const events = mkRedactionEvents()
|
|
||||||
const res = mount(
|
|
||||||
<WrappedMessagePanel
|
|
||||||
className="cls"
|
|
||||||
events={events}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
const Dates = res.find(sdk.getComponent('messages.DateSeparator'));
|
|
||||||
|
|
||||||
expect(Dates.length).toEqual(1);
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -218,39 +218,6 @@ export function mkMessage(opts) {
|
||||||
return mkEvent(opts);
|
return mkEvent(opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an Redacted Event.
|
|
||||||
* @param {Object} opts Values for the event.
|
|
||||||
* @param {string} opts.type The event.type
|
|
||||||
* @param {string} opts.room The event.room_id
|
|
||||||
* @param {string} opts.user The event.user_id
|
|
||||||
* @param {string} opts.skey Optional. The state key (auto inserts empty string)
|
|
||||||
* @param {Number} opts.ts Optional. Timestamp for the event
|
|
||||||
* @param {Object} opts.content The event.content
|
|
||||||
* @param {boolean} opts.event True to make a MatrixEvent.
|
|
||||||
* @return {Object} a JSON object representing this event.
|
|
||||||
*/
|
|
||||||
export function mkRedactedEvent(opts) {
|
|
||||||
if (!opts.type ) {
|
|
||||||
throw new Error("Missing .type =>" + JSON.stringify(opts));
|
|
||||||
}
|
|
||||||
const event = {
|
|
||||||
type: opts.type,
|
|
||||||
room_id: opts.room,
|
|
||||||
sender: opts.user,
|
|
||||||
content: {},
|
|
||||||
prev_content: opts.prev_content,
|
|
||||||
event_id: "$" + Math.random() + "-" + Math.random(),
|
|
||||||
origin_server_ts: opts.ts,
|
|
||||||
//isRedacted() only checks if redacted_because is true or not
|
|
||||||
// unsigned :{redacted_because:opts.redacted_because} This is not working atm
|
|
||||||
};
|
|
||||||
//Might want to add the other parameters for generalized tests
|
|
||||||
return opts.event ? new MatrixEvent(event) : event;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function mkStubRoom(roomId = null) {
|
export function mkStubRoom(roomId = null) {
|
||||||
const stubTimeline = { getEvents: () => [] };
|
const stubTimeline = { getEvents: () => [] };
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue