Extract compose_state.js.

This is mostly just moving methods out of compose.js.

The variable `is_composing_message`, which isn't a boolean, has
been renamed to `message_type`, and there are new functions
set_message_type() and get_message_type() that wrap it.

This commit removes some shims related to the global variable
`compose_state`; now, `compose_state` is a typical global
variable with a 1:1 relationship with the module by the same
name.

The new module has 100% line coverage, most of it coming
via the tests on compose_actions.js.  (The methods here are
super simple, so it's a good thing that the tests are somewhat
integrated with a higher layer.)
This commit is contained in:
Steve Howell
2017-04-14 16:15:59 -07:00
committed by Tim Abbott
parent 7e4155cd42
commit 70b7d4c00b
14 changed files with 122 additions and 94 deletions

View File

@@ -9,8 +9,3 @@ that still refer to the old name.
var narrow_state = {}; // global, should be made into module
narrow_state.set_compose_defaults = narrow.set_compose_defaults;
var compose_state = {};
compose_state.has_message_content = compose.has_message_content;
compose_state.recipient = compose.recipient;
compose_state.composing = compose.composing;