Skip to content

A platform for community discussion. Free, open, simple.

DEV: Add tests for c92c56d98642d932cb5a4227fefa3ca6e2774f6e.

Guo Xiang Tanceaf234f897d
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"
+ );
+});