Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose_state: Add is_topic_field_empty().

Dinesh1c0368c402b7
diff --git a/frontend_tests/node_tests/compose_state.js b/frontend_tests/node_tests/compose_state.js
index ebe306c01f7..24edb960286 100644
--- a/frontend_tests/node_tests/compose_state.js
+++ b/frontend_tests/node_tests/compose_state.js
@@ -20,3 +20,11 @@ run_test("private_message_recipient", ({override}) => {
compose_state.private_message_recipient("[email protected]");
assert.equal(compose_state.private_message_recipient(), "[email protected]");
});
+
+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);
+});
diff --git a/static/js/compose_state.js b/static/js/compose_state.js
index d8df637474c..f678b2f3552 100644
--- a/static/js/compose_state.js
+++ b/static/js/compose_state.js
@@ -84,3 +84,7 @@ export function private_message_recipient(value) {
export function has_message_content() {
return message_content() !== "";
}
+
+export function is_topic_field_empty() {
+ return topic() === "";
+}