From 6c2aefbe1188035bfc208ec11b64a832124b4248 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 29 Jan 2020 13:35:23 +1100 Subject: [PATCH] fix unit tests: remove not used count in scrolldown view and assert svg present --- js/views/scroll_down_button_view.js | 12 +------- test/views/scroll_down_button_view_test.js | 33 ++++------------------ 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/js/views/scroll_down_button_view.js b/js/views/scroll_down_button_view.js index 941ad814a..2f8bc60fb 100644 --- a/js/views/scroll_down_button_view.js +++ b/js/views/scroll_down_button_view.js @@ -7,22 +7,12 @@ window.Whisper = window.Whisper || {}; Whisper.ScrollDownButtonView = Whisper.View.extend({ - initialize(options = {}) { - this.count = options.count || 0; - }, - - increment(count = 0) { - this.count += count; - this.render(); - }, + initialize() {}, render() { this.scrollButtonView = new Whisper.ReactWrapperView({ className: 'module-scroll-down', Component: window.Signal.Components.SessionScrollButton, - props: { - count: this.count, - }, }); this.$el.append(this.scrollButtonView.el); diff --git a/test/views/scroll_down_button_view_test.js b/test/views/scroll_down_button_view_test.js index 27ff41072..df099a6b6 100644 --- a/test/views/scroll_down_button_view_test.js +++ b/test/views/scroll_down_button_view_test.js @@ -1,35 +1,12 @@ /* global Whisper */ describe('ScrollDownButtonView', () => { - it('renders with count = 0', () => { + it('renders ', () => { const view = new Whisper.ScrollDownButtonView(); view.render(); - assert.equal(view.count, 0); - assert.match(view.$el.html(), /Scroll to bottom/); - }); - - it('renders with count = 1', () => { - const view = new Whisper.ScrollDownButtonView({ count: 1 }); - view.render(); - assert.equal(view.count, 1); - assert.match(view.$el.html(), /New message below/); - }); - - it('renders with count = 2', () => { - const view = new Whisper.ScrollDownButtonView({ count: 2 }); - view.render(); - assert.equal(view.count, 2); - - assert.match(view.$el.html(), /New messages below/); - }); - - it('increments count and re-renders', () => { - const view = new Whisper.ScrollDownButtonView(); - view.render(); - assert.equal(view.count, 0); - assert.notMatch(view.$el.html(), /New message below/); - view.increment(1); - assert.equal(view.count, 1); - assert.match(view.$el.html(), /New message below/); + assert.match( + view.$el.html(), + /