mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
Ember Upgrade: 1.0
This commit is contained in:
@ -18,16 +18,16 @@ test("editingMode", function() {
|
||||
ok(!topicController.get('editingTopic'), "we are not editing by default");
|
||||
|
||||
topicController.set('model.details.can_edit', false);
|
||||
topicController.editTopic();
|
||||
topicController.send('editTopic');
|
||||
ok(!topicController.get('editingTopic'), "calling editTopic doesn't enable editing unless the user can edit");
|
||||
|
||||
topicController.set('model.details.can_edit', true);
|
||||
topicController.editTopic();
|
||||
topicController.send('editTopic');
|
||||
ok(topicController.get('editingTopic'), "calling editTopic enables editing if the user can edit");
|
||||
equal(topicController.get('newTitle'), topic.get('title'));
|
||||
equal(topicController.get('newCategoryId'), topic.get('category_id'));
|
||||
|
||||
topicController.cancelEditingTopic();
|
||||
topicController.send('cancelEditingTopic');
|
||||
ok(!topicController.get('editingTopic'), "cancelling edit mode reverts the property value");
|
||||
});
|
||||
|
||||
@ -43,12 +43,12 @@ test("toggledSelectedPost", function() {
|
||||
equal(tc.get('selectedPostsCount'), 0, "there is a selected post count of 0");
|
||||
ok(!tc.postSelected(post), "the post is not selected by default");
|
||||
|
||||
tc.toggledSelectedPost(post);
|
||||
tc.send('toggledSelectedPost', post);
|
||||
present(tc.get('selectedPosts'), "there is a selectedPosts collection");
|
||||
equal(tc.get('selectedPostsCount'), 1, "there is a selected post now");
|
||||
ok(tc.postSelected(post), "the post is now selected");
|
||||
|
||||
tc.toggledSelectedPost(post);
|
||||
tc.send('toggledSelectedPost', post);
|
||||
ok(!tc.postSelected(post), "the post is no longer selected");
|
||||
|
||||
});
|
||||
@ -61,10 +61,10 @@ test("selectAll", function() {
|
||||
postStream.appendPost(post);
|
||||
|
||||
ok(!tc.postSelected(post), "the post is not selected by default");
|
||||
tc.selectAll();
|
||||
tc.send('selectAll');
|
||||
ok(tc.postSelected(post), "the post is now selected");
|
||||
ok(tc.get('allPostsSelected'), "all posts are selected");
|
||||
tc.deselectAll();
|
||||
tc.send('deselectAll');
|
||||
ok(!tc.postSelected(post), "the post is deselected again");
|
||||
ok(!tc.get('allPostsSelected'), "all posts are not selected");
|
||||
|
||||
@ -80,10 +80,10 @@ test("Automating setting of allPostsSelected", function() {
|
||||
postStream.appendPost(post);
|
||||
ok(!tc.get('allPostsSelected'), "all posts are not selected by default");
|
||||
|
||||
tc.toggledSelectedPost(post);
|
||||
tc.send('toggledSelectedPost', post);
|
||||
ok(tc.get('allPostsSelected'), "all posts are selected if we select the only post");
|
||||
|
||||
tc.toggledSelectedPost(post);
|
||||
tc.send('toggledSelectedPost', post);
|
||||
ok(!tc.get('allPostsSelected'), "the posts are no longer automatically selected");
|
||||
});
|
||||
|
||||
@ -96,20 +96,20 @@ test("Select Replies when present", function() {
|
||||
postStream = tc.get('postStream');
|
||||
|
||||
ok(!tc.postSelected(p3), "replies are not selected by default");
|
||||
tc.toggledSelectedPostReplies(p1);
|
||||
tc.send('toggledSelectedPostReplies', p1);
|
||||
ok(tc.postSelected(p1), "it selects the post");
|
||||
ok(!tc.postSelected(p2), "it doesn't select a post that's not a reply");
|
||||
ok(tc.postSelected(p3), "it selects a post that is a reply");
|
||||
equal(tc.get('selectedPostsCount'), 2, "it has a selected posts count of two");
|
||||
|
||||
// If we deselected the post whose replies are selected...
|
||||
tc.toggledSelectedPost(p1);
|
||||
tc.send('toggledSelectedPost', p1);
|
||||
ok(!tc.postSelected(p1), "it deselects the post");
|
||||
ok(!tc.postSelected(p3), "it deselects the replies too");
|
||||
|
||||
// If we deselect a reply, it should deselect the parent's replies selected attribute. Weird but what else would make sense?
|
||||
tc.toggledSelectedPostReplies(p1);
|
||||
tc.toggledSelectedPost(p3);
|
||||
tc.send('toggledSelectedPostReplies', p1);
|
||||
tc.send('toggledSelectedPost', p3);
|
||||
ok(tc.postSelected(p1), "the post stays selected");
|
||||
ok(!tc.postSelected(p3), "it deselects the replies too");
|
||||
|
||||
|
Reference in New Issue
Block a user