FIX: Highlighting was not being applied after some rendering.
Also includes a bunch of ES6 stuff.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
module("Discourse.PostStream");
|
||||
module("model:post-stream");
|
||||
|
||||
import PostStream from 'discourse/models/post-stream';
|
||||
import Topic from 'discourse/models/topic';
|
||||
|
||||
var buildStream = function(id, stream) {
|
||||
var topic = Discourse.Topic.create({id: id, chunk_size: 5});
|
||||
var topic = Topic.create({id: id, chunk_size: 5});
|
||||
var ps = topic.get('postStream');
|
||||
if (stream) {
|
||||
ps.set('stream', stream);
|
||||
@@ -12,7 +15,7 @@ var buildStream = function(id, stream) {
|
||||
var participant = {username: 'eviltrout'};
|
||||
|
||||
test('create', function() {
|
||||
ok(Discourse.PostStream.create(), 'it can be created with no parameters');
|
||||
ok(PostStream.create(), 'it can be created with no parameters');
|
||||
});
|
||||
|
||||
test('defaults', function() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
module("Discourse.TopicDetails");
|
||||
module("model:topic-details");
|
||||
|
||||
import Topic from 'discourse/models/topic';
|
||||
|
||||
var buildDetails = function(id) {
|
||||
var topic = Discourse.Topic.create({id: id});
|
||||
var topic = Topic.create({id: id});
|
||||
return topic.get('details');
|
||||
};
|
||||
|
||||
@@ -20,13 +22,9 @@ test('updateFromJson', function() {
|
||||
});
|
||||
|
||||
equal(details.get('suggested_topics.length'), 2, 'it loaded the suggested_topics');
|
||||
containsInstance(details.get('suggested_topics'), Discourse.Topic);
|
||||
containsInstance(details.get('suggested_topics'), Topic);
|
||||
|
||||
equal(details.get('allowed_users.length'), 1, 'it loaded the allowed users');
|
||||
containsInstance(details.get('allowed_users'), Discourse.User);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
module("Discourse.Topic");
|
||||
module("model:topic");
|
||||
|
||||
import Topic from 'discourse/models/topic';
|
||||
|
||||
test("defaults", function() {
|
||||
var topic = Discourse.Topic.create({id: 1234});
|
||||
var topic = Topic.create({id: 1234});
|
||||
blank(topic.get('deleted_at'), 'deleted_at defaults to blank');
|
||||
blank(topic.get('deleted_by'), 'deleted_by defaults to blank');
|
||||
});
|
||||
|
||||
test('has details', function() {
|
||||
var topic = Discourse.Topic.create({id: 1234});
|
||||
var topic = Topic.create({id: 1234});
|
||||
var topicDetails = topic.get('details');
|
||||
present(topicDetails, "a topic has topicDetails after we create it");
|
||||
equal(topicDetails.get('topic'), topic, "the topicDetails has a reference back to the topic");
|
||||
});
|
||||
|
||||
test('has a postStream', function() {
|
||||
var topic = Discourse.Topic.create({id: 1234});
|
||||
var topic = Topic.create({id: 1234});
|
||||
var postStream = topic.get('postStream');
|
||||
present(postStream, "a topic has a postStream after we create it");
|
||||
equal(postStream.get('topic'), topic, "the postStream has a reference back to the topic");
|
||||
@@ -24,13 +26,13 @@ test('has a postStream', function() {
|
||||
test('category relationship', function() {
|
||||
// It finds the category by id
|
||||
var category = Discourse.Category.list()[0],
|
||||
topic = Discourse.Topic.create({id: 1111, category_id: category.get('id') });
|
||||
topic = Topic.create({id: 1111, category_id: category.get('id') });
|
||||
|
||||
equal(topic.get('category'), category);
|
||||
});
|
||||
|
||||
test("updateFromJson", function() {
|
||||
var topic = Discourse.Topic.create({id: 1234}),
|
||||
var topic = Topic.create({id: 1234}),
|
||||
category = Discourse.Category.list()[0];
|
||||
|
||||
topic.updateFromJson({
|
||||
@@ -48,7 +50,7 @@ test("updateFromJson", function() {
|
||||
|
||||
test("destroy", function() {
|
||||
var user = Discourse.User.create({username: 'eviltrout'});
|
||||
var topic = Discourse.Topic.create({id: 1234});
|
||||
var topic = Topic.create({id: 1234});
|
||||
|
||||
sandbox.stub(Discourse, 'ajax');
|
||||
|
||||
@@ -60,7 +62,7 @@ test("destroy", function() {
|
||||
|
||||
test("recover", function() {
|
||||
var user = Discourse.User.create({username: 'eviltrout'});
|
||||
var topic = Discourse.Topic.create({id: 1234, deleted_at: new Date(), deleted_by: user});
|
||||
var topic = Topic.create({id: 1234, deleted_at: new Date(), deleted_by: user});
|
||||
|
||||
sandbox.stub(Discourse, 'ajax');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user