mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 22:26:15 +08:00
FEATURE: Use virtual dom framework for faster post rendering
This commit is contained in:
@ -27,40 +27,6 @@ test('defaults', function() {
|
||||
present(postStream.get('topic'));
|
||||
});
|
||||
|
||||
test('daysSincePrevious when appending', function(assert) {
|
||||
const postStream = buildStream(10000001, [1,2,3]);
|
||||
const store = postStream.store;
|
||||
|
||||
const p1 = store.createRecord('post', {id: 1, post_number: 1, created_at: "2015-05-29T18:17:35.868Z"}),
|
||||
p2 = store.createRecord('post', {id: 2, post_number: 2, created_at: "2015-06-01T01:07:25.761Z"}),
|
||||
p3 = store.createRecord('post', {id: 3, post_number: 3, created_at: "2015-06-02T01:07:25.761Z"});
|
||||
|
||||
postStream.appendPost(p1);
|
||||
postStream.appendPost(p2);
|
||||
postStream.appendPost(p3);
|
||||
|
||||
assert.ok(!p1.get('daysSincePrevious'));
|
||||
assert.equal(p2.get('daysSincePrevious'), 2);
|
||||
assert.equal(p3.get('daysSincePrevious'), 1);
|
||||
});
|
||||
|
||||
test('daysSincePrevious when prepending', function(assert) {
|
||||
const postStream = buildStream(10000001, [1,2,3]);
|
||||
const store = postStream.store;
|
||||
|
||||
const p1 = store.createRecord('post', {id: 1, post_number: 1, created_at: "2015-05-29T18:17:35.868Z"}),
|
||||
p2 = store.createRecord('post', {id: 2, post_number: 2, created_at: "2015-06-01T01:07:25.761Z"}),
|
||||
p3 = store.createRecord('post', {id: 3, post_number: 3, created_at: "2015-06-02T01:07:25.761Z"});
|
||||
|
||||
postStream.prependPost(p3);
|
||||
postStream.prependPost(p2);
|
||||
postStream.prependPost(p1);
|
||||
|
||||
assert.ok(!p1.get('daysSincePrevious'));
|
||||
assert.equal(p2.get('daysSincePrevious'), 2);
|
||||
assert.equal(p3.get('daysSincePrevious'), 1);
|
||||
});
|
||||
|
||||
test('appending posts', function() {
|
||||
const postStream = buildStream(4567, [1, 3, 4]);
|
||||
const store = postStream.store;
|
||||
@ -320,17 +286,6 @@ test("loadIntoIdentityMap with post ids", function() {
|
||||
});
|
||||
});
|
||||
|
||||
test("loading a post's history", function() {
|
||||
const postStream = buildStream(1234);
|
||||
const store = postStream.store;
|
||||
const post = store.createRecord('post', {id: 4321});
|
||||
|
||||
postStream.findReplyHistory(post).then(function() {
|
||||
present(postStream.findLoadedPost(2222), "it stores the returned post in the identity map");
|
||||
present(post.get('replyHistory'), "it sets the replyHistory attribute for the post");
|
||||
});
|
||||
});
|
||||
|
||||
test("staging and undoing a new post", function() {
|
||||
const postStream = buildStream(10101, [1]);
|
||||
const store = postStream.store;
|
||||
|
@ -14,7 +14,6 @@ test('defaults', function() {
|
||||
var post = Discourse.Post.create({id: 1});
|
||||
blank(post.get('deleted_at'), "it has no deleted_at by default");
|
||||
blank(post.get('deleted_by'), "there is no deleted_by by default");
|
||||
equal(post.get('replyHistory.length'), 0, "there is no reply history by default");
|
||||
});
|
||||
|
||||
test('new_user', function() {
|
||||
@ -47,16 +46,6 @@ test('updateFromPost', function() {
|
||||
equal(post.get('raw'), "different raw", "raw field updated");
|
||||
});
|
||||
|
||||
test('hasHistory', function() {
|
||||
var post = Discourse.Post.create({id: 1});
|
||||
ok(!post.get('hasHistory'), 'posts without versions have no history');
|
||||
post.set('version', 1);
|
||||
ok(!post.get('hasHistory'), 'posts with one version have no history');
|
||||
post.set('version', 2);
|
||||
ok(post.get('hasHistory'), 'posts with more than one version have a history');
|
||||
});
|
||||
|
||||
|
||||
test('destroy by staff', function() {
|
||||
var user = Discourse.User.create({username: 'staff', staff: true}),
|
||||
post = buildPost({user: user});
|
||||
|
Reference in New Issue
Block a user