From 318162e74a45532342eb9096cc9c9651becf8a4e Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 18 May 2017 12:26:43 -0700 Subject: [PATCH] LastSeenIndicatorView: programmatic tests, tweak to manual tests FREEBIE --- test/manual.txt | 1 + test/views/last_seen_indicator_view_test.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/views/last_seen_indicator_view_test.js diff --git a/test/manual.txt b/test/manual.txt index 51970db0d..af4b8ed6c 100644 --- a/test/manual.txt +++ b/test/manual.txt @@ -5,6 +5,7 @@ Some things are very difficult to test programmatically. Also, if you don't have Conversation view: Last seen indicator: - Make window small, switch away from conversation, receive messages that would more than fill up the window, switch back to conversation: the 'N unread messages' text should be at the top of the window, most recent message should be off-screen + (do this with conversation already loaded and with conversation not previously loaded ) - Receive more messages while this is showing - the number should increment, and the window should not scroll - Scroll to the bottom of the window, receive more messages - each message should scroll the window down, so the latest message stays at the bottom of the window. - Increase the size of the window so that the 'N unread messages' text is showing. It should reflect the total count of messages below it diff --git a/test/views/last_seen_indicator_view_test.js b/test/views/last_seen_indicator_view_test.js new file mode 100644 index 000000000..04ddfa4da --- /dev/null +++ b/test/views/last_seen_indicator_view_test.js @@ -0,0 +1,18 @@ +/* + * vim: ts=4:sw=4:expandtab + */ +describe('LastSeenIndicatorView', function() { + // TODO: in electron branch, wheere we have access to real i18n, test rendered HTML + + it('renders provided count', function() { + var view = new Whisper.LastSeenIndicatorView({count: 10}); + assert.equal(view.count, 10); + }); + + it('increments count', function() { + var view = new Whisper.LastSeenIndicatorView({count: 4}); + assert.equal(view.count, 4); + view.increment(3); + assert.equal(view.count, 7); + }); +});