mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Enable JSHINT's unused option. It caught a bunch of suspicious stuff which is fixed in this commit.
This commit is contained in:
@@ -92,8 +92,7 @@ test("Select Replies when present", function() {
|
||||
tc = testController(Discourse.TopicController, topic),
|
||||
p1 = Discourse.Post.create({id: 1, post_number: 1, reply_count: 1}),
|
||||
p2 = Discourse.Post.create({id: 2, post_number: 2}),
|
||||
p3 = Discourse.Post.create({id: 2, post_number: 3, reply_to_post_number: 1}),
|
||||
postStream = tc.get('postStream');
|
||||
p3 = Discourse.Post.create({id: 2, post_number: 3, reply_to_post_number: 1});
|
||||
|
||||
ok(!tc.postSelected(p3), "replies are not selected by default");
|
||||
tc.send('toggledSelectedPostReplies', p1);
|
||||
|
||||
@@ -150,6 +150,7 @@ var jsHintOpts = {
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/*global md5:true */
|
||||
module("Discourse.BBCode");
|
||||
|
||||
var format = function(input, expected, text) {
|
||||
|
||||
@@ -28,10 +28,6 @@ var formatDays = function(days) {
|
||||
return formatHours(days * 24);
|
||||
};
|
||||
|
||||
var formatMonths = function(months) {
|
||||
return formatDays(months * 30);
|
||||
};
|
||||
|
||||
var shortDate = function(days){
|
||||
return moment().subtract('days', days).format('D MMM');
|
||||
};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
module("Discourse.HTML");
|
||||
|
||||
var html = Discourse.HTML;
|
||||
|
||||
test("categoryLink without a category", function() {
|
||||
blank(Discourse.HTML.categoryLink(), "it returns no HTML");
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/*global sanitizeHtml:true */
|
||||
|
||||
module("Discourse.Markdown", {
|
||||
setup: function() {
|
||||
Discourse.SiteSettings.traditional_markdown_linebreaks = false;
|
||||
@@ -173,7 +171,7 @@ test("Quotes", function() {
|
||||
"handles quotes properly");
|
||||
|
||||
cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2",
|
||||
{ topicId: 2, lookupAvatar: function(name) { } },
|
||||
{ topicId: 2, lookupAvatar: function() { } },
|
||||
"<p>1</p>\n\n<p><aside class=\"quote\" data-post=\"1\"><div class=\"title\"><div class=\"quote-controls\"></div>bob said:" +
|
||||
"</div><blockquote><p>my quote</p></blockquote></aside></p>\n\n<p>2</p>",
|
||||
"includes no avatar if none is found");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module("Discourse.SelectedPostsCount");
|
||||
|
||||
var buildTestObj = function(params, topicParams) {
|
||||
var buildTestObj = function(params) {
|
||||
return Ember.Object.createWithMixins(Discourse.SelectedPostsCount, params || {});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module("Discourse.Composer");
|
||||
|
||||
test('replyLength', function() {
|
||||
var replyLength = function(val, expectedLength, text) {
|
||||
var replyLength = function(val, expectedLength) {
|
||||
var composer = Discourse.Composer.create({ reply: val });
|
||||
equal(composer.get('replyLength'), expectedLength);
|
||||
};
|
||||
|
||||
@@ -227,7 +227,7 @@ test("storePost", function() {
|
||||
test("identity map", function() {
|
||||
var postStream = buildStream(1234);
|
||||
var p1 = postStream.appendPost(Discourse.Post.create({id: 1, post_number: 1}));
|
||||
var p3 = postStream.appendPost(Discourse.Post.create({id: 3, post_number: 4}));
|
||||
postStream.appendPost(Discourse.Post.create({id: 3, post_number: 4}));
|
||||
|
||||
equal(postStream.findLoadedPost(1), p1, "it can return cached posts by id");
|
||||
blank(postStream.findLoadedPost(4), "it can't find uncached posts");
|
||||
@@ -403,7 +403,7 @@ test("comitting and triggerNewPostInStream race condition", function() {
|
||||
var user = Discourse.User.create({username: 'eviltrout', name: 'eviltrout', id: 321});
|
||||
var stagedPost = Discourse.Post.create({ raw: 'hello world this is my new post' });
|
||||
|
||||
var result = postStream.stagePost(stagedPost, user);
|
||||
postStream.stagePost(stagedPost, user);
|
||||
equal(postStream.get('filteredPostsCount'), 0, "it has no filteredPostsCount yet");
|
||||
stagedPost.set('id', 123);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user