FIX: Highlighting was not being applied after some rendering.

Also includes a bunch of ES6 stuff.
This commit is contained in:
Robin Ward
2015-02-12 15:37:02 -05:00
parent 96697c7957
commit a519fd5bcf
21 changed files with 314 additions and 503 deletions

View File

@ -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');