Merge branch 'develop' into katex
This commit is contained in:
commit
5f3af7863a
151 changed files with 4951 additions and 1527 deletions
|
@ -38,6 +38,7 @@ import { configure, mount } from "enzyme";
|
|||
import Velocity from 'velocity-animate';
|
||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||
import RoomContext from "../../../src/contexts/RoomContext";
|
||||
import DMRoomMap from "../../../src/utils/DMRoomMap";
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
|
@ -52,7 +53,7 @@ class WrappedMessagePanel extends React.Component {
|
|||
|
||||
render() {
|
||||
return <MatrixClientContext.Provider value={client}>
|
||||
<RoomContext.Provider value={{ canReact: true, canReply: true }}>
|
||||
<RoomContext.Provider value={{ canReact: true, canReply: true, room, roomId: room.roomId }}>
|
||||
<MessagePanel room={room} {...this.props} resizeNotifier={this.state.resizeNotifier} />
|
||||
</RoomContext.Provider>
|
||||
</MatrixClientContext.Provider>;
|
||||
|
@ -79,6 +80,8 @@ describe('MessagePanel', function() {
|
|||
// complete without this even if we mock the clock and tick it
|
||||
// what should be the correct amount of time).
|
||||
Velocity.mock = true;
|
||||
|
||||
DMRoomMap.makeShared();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
@ -433,8 +436,8 @@ describe('MessagePanel', function() {
|
|||
const rm = res.find('.mx_RoomView_myReadMarker_container').getDOMNode();
|
||||
|
||||
const rows = res.find('.mx_RoomView_MessageList').children();
|
||||
expect(rows.length).toEqual(6);
|
||||
expect(rm.previousSibling).toEqual(rows.at(4).getDOMNode());
|
||||
expect(rows.length).toEqual(7); // 6 events + the NewRoomIntro
|
||||
expect(rm.previousSibling).toEqual(rows.at(5).getDOMNode());
|
||||
|
||||
// read marker should be hidden given props and at the last event
|
||||
expect(isReadMarkerVisible(rm)).toBeFalsy();
|
||||
|
|
|
@ -64,7 +64,7 @@ async function createDm(session, invitees) {
|
|||
const startChatButton = await dmsSublist.$(".mx_RoomSublist_auxButton");
|
||||
await startChatButton.click();
|
||||
|
||||
const inviteesEditor = await session.query('.mx_InviteDialog_editor textarea');
|
||||
const inviteesEditor = await session.query('.mx_InviteDialog_editor input');
|
||||
for (const target of invitees) {
|
||||
await session.replaceInputText(inviteesEditor, target);
|
||||
await session.delay(1000); // give it a moment to figure out a suggestion
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = async function invite(session, userId) {
|
|||
}
|
||||
const inviteButton = await session.query(".mx_MemberList_invite");
|
||||
await inviteButton.click();
|
||||
const inviteTextArea = await session.query(".mx_InviteDialog_editor textarea");
|
||||
const inviteTextArea = await session.query(".mx_InviteDialog_editor input");
|
||||
await inviteTextArea.type(userId);
|
||||
const selectUserItem = await session.query(".mx_InviteDialog_roomTile");
|
||||
await selectUserItem.click();
|
||||
|
|
|
@ -14,15 +14,12 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
var notifications = require('../../src/notifications');
|
||||
const notifications = require('../../src/notifications');
|
||||
|
||||
var ContentRules = notifications.ContentRules;
|
||||
var PushRuleVectorState = notifications.PushRuleVectorState;
|
||||
const ContentRules = notifications.ContentRules;
|
||||
const PushRuleVectorState = notifications.PushRuleVectorState;
|
||||
|
||||
var expect = require('expect');
|
||||
var test_utils = require('../test-utils');
|
||||
|
||||
var NORMAL_RULE = {
|
||||
const NORMAL_RULE = {
|
||||
actions: [
|
||||
"notify",
|
||||
{ set_tweak: "highlight", value: false },
|
||||
|
@ -32,7 +29,7 @@ var NORMAL_RULE = {
|
|||
rule_id: "vdh2",
|
||||
};
|
||||
|
||||
var LOUD_RULE = {
|
||||
const LOUD_RULE = {
|
||||
actions: [
|
||||
"notify",
|
||||
{ set_tweak: "highlight" },
|
||||
|
@ -43,7 +40,7 @@ var LOUD_RULE = {
|
|||
rule_id: "vdh2",
|
||||
};
|
||||
|
||||
var USERNAME_RULE = {
|
||||
const USERNAME_RULE = {
|
||||
actions: [
|
||||
"notify",
|
||||
{ set_tweak: "sound", value: "default" },
|
||||
|
@ -56,26 +53,25 @@ var USERNAME_RULE = {
|
|||
};
|
||||
|
||||
|
||||
|
||||
describe("ContentRules", function() {
|
||||
describe("parseContentRules", function() {
|
||||
it("should handle there being no keyword rules", function() {
|
||||
var rules = { 'global': { 'content': [
|
||||
const rules = { 'global': { 'content': [
|
||||
USERNAME_RULE,
|
||||
]}};
|
||||
var parsed = ContentRules.parseContentRules(rules);
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules).toEqual([]);
|
||||
expect(parsed.vectorState).toEqual(PushRuleVectorState.ON);
|
||||
expect(parsed.externalRules).toEqual([]);
|
||||
});
|
||||
|
||||
it("should parse regular keyword notifications", function() {
|
||||
var rules = { 'global': { 'content': [
|
||||
const rules = { 'global': { 'content': [
|
||||
NORMAL_RULE,
|
||||
USERNAME_RULE,
|
||||
]}};
|
||||
|
||||
var parsed = ContentRules.parseContentRules(rules);
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules.length).toEqual(1);
|
||||
expect(parsed.rules[0]).toEqual(NORMAL_RULE);
|
||||
expect(parsed.vectorState).toEqual(PushRuleVectorState.ON);
|
||||
|
@ -83,12 +79,12 @@ describe("ContentRules", function() {
|
|||
});
|
||||
|
||||
it("should parse loud keyword notifications", function() {
|
||||
var rules = { 'global': { 'content': [
|
||||
const rules = { 'global': { 'content': [
|
||||
LOUD_RULE,
|
||||
USERNAME_RULE,
|
||||
]}};
|
||||
|
||||
var parsed = ContentRules.parseContentRules(rules);
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules.length).toEqual(1);
|
||||
expect(parsed.rules[0]).toEqual(LOUD_RULE);
|
||||
expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD);
|
||||
|
@ -96,13 +92,13 @@ describe("ContentRules", function() {
|
|||
});
|
||||
|
||||
it("should parse mixed keyword notifications", function() {
|
||||
var rules = { 'global': { 'content': [
|
||||
const rules = { 'global': { 'content': [
|
||||
LOUD_RULE,
|
||||
NORMAL_RULE,
|
||||
USERNAME_RULE,
|
||||
]}};
|
||||
|
||||
var parsed = ContentRules.parseContentRules(rules);
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules.length).toEqual(1);
|
||||
expect(parsed.rules[0]).toEqual(LOUD_RULE);
|
||||
expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD);
|
||||
|
|
|
@ -14,16 +14,14 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
var notifications = require('../../src/notifications');
|
||||
const notifications = require('../../src/notifications');
|
||||
|
||||
var prvs = notifications.PushRuleVectorState;
|
||||
|
||||
var expect = require('expect');
|
||||
const prvs = notifications.PushRuleVectorState;
|
||||
|
||||
describe("PushRuleVectorState", function() {
|
||||
describe("contentRuleVectorStateKind", function() {
|
||||
it("should understand normal notifications", function () {
|
||||
var rule = {
|
||||
it("should understand normal notifications", function() {
|
||||
const rule = {
|
||||
actions: [
|
||||
"notify",
|
||||
],
|
||||
|
@ -33,26 +31,26 @@ describe("PushRuleVectorState", function() {
|
|||
toEqual(prvs.ON);
|
||||
});
|
||||
|
||||
it("should handle loud notifications", function () {
|
||||
var rule = {
|
||||
it("should handle loud notifications", function() {
|
||||
const rule = {
|
||||
actions: [
|
||||
"notify",
|
||||
{ set_tweak: "highlight", value: true },
|
||||
{ set_tweak: "sound", value: "default" },
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
expect(prvs.contentRuleVectorStateKind(rule)).
|
||||
toEqual(prvs.LOUD);
|
||||
});
|
||||
|
||||
it("should understand missing highlight.value", function () {
|
||||
var rule = {
|
||||
it("should understand missing highlight.value", function() {
|
||||
const rule = {
|
||||
actions: [
|
||||
"notify",
|
||||
{ set_tweak: "highlight" },
|
||||
{ set_tweak: "sound", value: "default" },
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
expect(prvs.contentRuleVectorStateKind(rule)).
|
||||
|
|
|
@ -242,6 +242,7 @@ export function mkStubRoom(roomId = null) {
|
|||
setBlacklistUnverifiedDevices: jest.fn(),
|
||||
on: jest.fn(),
|
||||
removeListener: jest.fn(),
|
||||
getDMInviter: jest.fn(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue