mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 10:43:40 +08:00
FIX: Highlighting was not being applied after some rendering.
Also includes a bunch of ES6 stuff.
This commit is contained in:
@ -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