From ceaf234f897d2e7c2eabdafccc0e46ab647cdbea Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 29 Nov 2018 13:51:31 +0800 Subject: [PATCH] DEV: Add tests for c92c56d98642d932cb5a4227fefa3ca6e2774f6e. --- .../javascripts/controllers/topic-test.js.es6 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/javascripts/controllers/topic-test.js.es6 b/test/javascripts/controllers/topic-test.js.es6 index 968c8d9f777..ac3c1329359 100644 --- a/test/javascripts/controllers/topic-test.js.es6 +++ b/test/javascripts/controllers/topic-test.js.es6 @@ -1,5 +1,7 @@ import AppEvents from "discourse/lib/app-events"; import Topic from "discourse/models/topic"; +import PostStream from "discourse/models/post-stream"; +import { Placeholder } from "discourse/lib/posts-with-placeholders"; moduleFor("controller:topic", "controller:topic", { needs: ["controller:composer", "controller:application"], @@ -495,3 +497,21 @@ QUnit.test("selectBelow", function(assert) { assert.equal(selectedPostIds[1], 4, "also selected 1st post below post #3"); assert.equal(selectedPostIds[2], 5, "also selected 2nd post below post #3"); }); + +QUnit.test("topVisibleChanged", function(assert) { + const postStream = PostStream.create({ + posts: [{ id: 1 }] + }); + + const model = Topic.create({ postStream }); + const controller = this.subject({ model }); + const placeholder = new Placeholder("post-placeholder"); + + assert.equal( + controller.send("topVisibleChanged", { + post: placeholder + }), + null, + "it should work with a post-placehodler" + ); +});