2021-03-05 16:57:23 +01:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const {strict: assert} = require("assert");
|
|
|
|
|
2021-03-10 06:10:32 +01:00
|
|
|
const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
2021-03-05 16:57:23 +01:00
|
|
|
const {run_test} = require("../zjsunit/test");
|
|
|
|
|
2021-03-10 06:10:32 +01:00
|
|
|
const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill");
|
2021-03-05 16:57:23 +01:00
|
|
|
|
|
|
|
const compose_state = zrequire("compose_state");
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("private_message_recipient", ({override}) => {
|
2021-03-05 16:57:23 +01:00
|
|
|
let emails;
|
|
|
|
override(compose_pm_pill, "set_from_emails", (value) => {
|
|
|
|
emails = value;
|
|
|
|
});
|
|
|
|
|
|
|
|
override(compose_pm_pill, "get_emails", () => emails);
|
|
|
|
|
|
|
|
compose_state.private_message_recipient("fred@fred.org");
|
|
|
|
assert.equal(compose_state.private_message_recipient(), "fred@fred.org");
|
|
|
|
});
|
2022-03-09 18:29:01 +01:00
|
|
|
|
|
|
|
run_test("is_topic_field_empty", () => {
|
|
|
|
compose_state.topic("");
|
|
|
|
assert.equal(compose_state.is_topic_field_empty(), true);
|
|
|
|
|
|
|
|
compose_state.topic("foo");
|
|
|
|
assert.equal(compose_state.is_topic_field_empty(), false);
|
|
|
|
});
|