Improve parsing of keyword notification rules
For notification rules, the absence of a value on a 'highlight' tweak means that the highlight should happen; this was previously confusing us. Use the action parser from NotificationUtils to simplify the code. Fixes https://github.com/vector-im/vector-web/issues/1330
This commit is contained in:
parent
5450223cc7
commit
121fe34180
3 changed files with 163 additions and 9 deletions
|
@ -23,8 +23,40 @@ var expect = require('expect');
|
|||
describe("PushRuleVectorState", function() {
|
||||
describe("contentRuleVectorStateKind", function() {
|
||||
it("should understand normal notifications", function () {
|
||||
expect(prvs.contentRuleVectorStateKind(["notify"])).
|
||||
var rule = {
|
||||
actions: [
|
||||
"notify",
|
||||
],
|
||||
};
|
||||
|
||||
expect(prvs.contentRuleVectorStateKind(rule)).
|
||||
toEqual(prvs.ON);
|
||||
});
|
||||
|
||||
it("should handle loud notifications", function () {
|
||||
var 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 = {
|
||||
actions: [
|
||||
"notify",
|
||||
{ set_tweak: "highlight" },
|
||||
{ set_tweak: "sound", value: "default" },
|
||||
]
|
||||
};
|
||||
|
||||
expect(prvs.contentRuleVectorStateKind(rule)).
|
||||
toEqual(prvs.LOUD);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue