DEV: Add tests for c92c56d986.

This commit is contained in:
Guo Xiang Tan 2018-11-29 13:51:31 +08:00
parent 871d4543cc
commit ceaf234f89
1 changed files with 20 additions and 0 deletions

View File

@ -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"
);
});