","post_number":1,"post_type":1,"updated_at":"2016-12-01T02:47:18.317Z","reply_count":0,"reply_to_post_number":null,"quote_count":0,"avg_time":null,"incoming_link_count":0,"reads":1,"score":0,"yours":true,"topic_id":13,"topic_slug":"this-is-a-test-topic-for-polls","display_username":null,"primary_group_name":null,"primary_group_flair_url":null,"primary_group_flair_bg_color":null,"primary_group_flair_color":null,"version":2,"can_edit":true,"can_delete":false,"can_recover":true,"can_wiki":true,"read":true,"user_title":null,"actions_summary":[{"id":3,"can_act":true},{"id":4,"can_act":true},{"id":5,"hidden":true,"can_act":true},{"id":7,"can_act":true},{"id":8,"can_act":true}],"moderator":false,"admin":true,"staff":true,"user_id":1,"hidden":false,"hidden_reason_id":null,"trust_level":4,"deleted_at":null,"user_deleted":false,"edit_reason":null,"can_view_edit_history":true,"wiki":false,"polls":{"poll":{"options":[{"id":"57ddd734344eb7436d64a7d68a0df444","html":"test","votes":0},{"id":"b5b78d79ab5b5d75d4d33d8b87f5d2aa","html":"haha","votes":0}],"voters":2,"status":"open","name":"poll"},"test":{"options":[{"id":"c26ad90783b0d80936e5fdb292b7963c","html":"donkey","votes":0},{"id":"99f2b9ac452ba73b115fcf3556e6d2d4","html":"kong","votes":0}],"voters":3,"status":"open","name":"test"}}}],"stream":[19]},"timeline_lookup":[[1,0]],"id":13,"title":"This is a test topic for polls","fancy_title":"This is a test topic for polls","posts_count":1,"created_at":"2016-12-01T02:39:48.055Z","views":1,"reply_count":0,"participant_count":1,"like_count":0,"last_posted_at":"2016-12-01T02:39:49.199Z","visible":true,"closed":false,"archived":false,"has_summary":false,"archetype":"regular","slug":"this-is-a-test-topic-for-polls","category_id":1,"word_count":10,"deleted_at":null,"user_id":1,"draft":null,"draft_key":"topic_13","draft_sequence":4,"posted":true,"unpinned":null,"pinned_globally":false,"pinned":false,"pinned_at":null,"pinned_until":null,"details":{"auto_close_at":null,"auto_close_hours":null,"auto_close_based_on_last_post":false,"created_by":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"},"last_poster":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"},"participants":[{"id":1,"username":"tgx","avatar_template":"/images/avatar.png","post_count":1}],"suggested_topics":[{"id":8,"title":"Welcome to Discourse","fancy_title":"Welcome to Discourse","slug":"welcome-to-discourse","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2016-11-24T02:10:54.328Z","last_posted_at":"2016-11-24T02:10:54.393Z","bumped":true,"bumped_at":"2016-11-24T02:10:54.393Z","unseen":false,"pinned":true,"unpinned":null,"excerpt":"The first paragraph of this pinned topic will be visible as a welcome message to all new visitors on your homepage. It's important! \n\nEdit this into a brief description of your community: \n\n\nWho is it for?\nWhat can they …","visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"archetype":"regular","like_count":0,"views":0,"category_id":1,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user":{"id":-1,"username":"system","avatar_template":"/images/avatar.png"}}]},{"id":12,"title":"Some testing topic testing","fancy_title":"Some testing topic testing","slug":"some-testing-topic-testing","posts_count":4,"reply_count":0,"highest_post_number":4,"image_url":null,"created_at":"2016-11-24T08:36:08.773Z","last_posted_at":"2016-12-01T01:15:52.008Z","bumped":true,"bumped_at":"2016-12-01T01:15:52.008Z","unseen":false,"last_read_post_number":4,"unread":0,"new_posts":0,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"notification_level":3,"bookmarked":false,"liked":false,"archetype":"regular","like_count":0,"views":2,"category_id":1,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"}}]},{"id":11,"title":"Some testing topic","fancy_title":"Some testing topic","slug":"some-testing-topic","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2016-11-24T08:35:26.758Z","last_posted_at":"2016-11-24T08:35:26.894Z","bumped":true,"bumped_at":"2016-11-24T08:35:26.894Z","unseen":false,"last_read_post_number":1,"unread":0,"new_posts":0,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"notification_level":3,"bookmarked":false,"liked":false,"archetype":"regular","like_count":0,"views":0,"category_id":1,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"}}]}],"notification_level":3,"notifications_reason_id":1,"can_move_posts":true,"can_edit":true,"can_delete":true,"can_recover":true,"can_remove_allowed_users":true,"can_invite_to":true,"can_create_post":true,"can_reply_as_new_topic":true,"can_flag_topic":true},"highest_post_number":1,"last_read_post_number":1,"last_read_post_id":19,"deleted_by":null,"has_deleted":false,"actions_summary":[{"id":4,"count":0,"hidden":false,"can_act":true},{"id":7,"count":0,"hidden":false,"can_act":true},{"id":8,"count":0,"hidden":false,"can_act":true}],"chunk_size":20,"bookmarked":false}
- ]
+ ];
});
visit("/t/this-is-a-test-topic-for-polls/13");
@@ -19,19 +19,19 @@ test("Single Poll", () => {
andThen(() => {
const polls = find('.poll');
- equal(polls.length, 2, 'it should render the polls correctly');
- equal(find('.info-number', polls[0]).text(), '2', 'it should display the right number of votes');
- equal(find('.info-number', polls[1]).text(), '3', 'it should display the right number of votes');
+ assert.equal(polls.length, 2, 'it should render the polls correctly');
+ assert.equal(find('.info-number', polls[0]).text(), '2', 'it should display the right number of votes');
+ assert.equal(find('.info-number', polls[1]).text(), '3', 'it should display the right number of votes');
});
});
-test("Public poll", () => {
+test("Public poll", assert => {
server.get('/t/12.json', () => {
return [
200,
{ "Content-Type": "application/json" },
{"post_stream":{"posts":[{"id":15,"name":null,"username":"tgx","avatar_template":"/images/avatar.png","created_at":"2017-01-31T08:39:06.237Z","cooked":"
","post_number":1,"post_type":1,"updated_at":"2017-01-31T08:39:06.237Z","reply_count":0,"reply_to_post_number":null,"quote_count":0,"avg_time":null,"incoming_link_count":0,"reads":1,"score":0,"yours":true,"topic_id":12,"topic_slug":"this-is-a-topic-created-for-testing","display_username":null,"primary_group_name":null,"primary_group_flair_url":null,"primary_group_flair_bg_color":null,"primary_group_flair_color":null,"version":1,"can_edit":true,"can_delete":false,"can_recover":true,"can_wiki":true,"read":true,"user_title":null,"actions_summary":[{"id":3,"can_act":true},{"id":4,"can_act":true},{"id":5,"hidden":true,"can_act":true},{"id":7,"can_act":true},{"id":8,"can_act":true}],"moderator":false,"admin":true,"staff":true,"user_id":1,"hidden":false,"hidden_reason_id":null,"trust_level":4,"deleted_at":null,"user_deleted":false,"edit_reason":null,"can_view_edit_history":true,"wiki":false,"polls":{"poll":{"options":[{"id":"4d8a15e3cc35750f016ce15a43937620","html":"1","votes":29},{"id":"cd314db7dfbac2b10687b6f39abfdf41","html":"2","votes":29},{"id":"68b434ff88aeae7054e42cd05a4d9056","html":"3","votes":42}],"voters":100,"status":"open","name":"poll","type":"multiple","min":"1","max":"3","public":"true"}}}],"stream":[15]},"timeline_lookup":[[1,0]],"id":12,"title":"This is a topic created for testing","fancy_title":"This is a topic created for testing","posts_count":1,"created_at":"2017-01-31T08:39:06.094Z","views":1,"reply_count":0,"participant_count":1,"like_count":0,"last_posted_at":"2017-01-31T08:39:06.237Z","visible":true,"closed":false,"archived":false,"has_summary":false,"archetype":"regular","slug":"this-is-a-topic-created-for-testing","category_id":1,"word_count":13,"deleted_at":null,"user_id":1,"draft":null,"draft_key":"topic_12","draft_sequence":1,"posted":true,"unpinned":null,"pinned_globally":false,"pinned":false,"pinned_at":null,"pinned_until":null,"details":{"auto_close_at":null,"auto_close_hours":null,"auto_close_based_on_last_post":false,"created_by":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"},"last_poster":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"},"participants":[{"id":1,"username":"tgx","avatar_template":"/images/avatar.png","post_count":1,"primary_group_name":null,"primary_group_flair_url":null,"primary_group_flair_color":null,"primary_group_flair_bg_color":null}],"suggested_topics":[{"id":8,"title":"Welcome to Discourse","fancy_title":"Welcome to Discourse","slug":"welcome-to-discourse","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2017-01-31T07:53:45.363Z","last_posted_at":"2017-01-31T07:53:45.439Z","bumped":true,"bumped_at":"2017-01-31T07:53:45.439Z","unseen":false,"pinned":true,"unpinned":null,"excerpt":"The first paragraph of this pinned topic will be visible as a welcome message to all new visitors on your homepage. It's important! \n\nEdit this into a brief description of your community: \n\n\nWho is it for?\nWhat can they …","visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"archetype":"regular","like_count":0,"views":0,"category_id":1,"featured_link":null,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user":{"id":-1,"username":"system","avatar_template":"/images/avatar.png"}}]},{"id":11,"title":"This is a test post to try out posts","fancy_title":"This is a test post to try out posts","slug":"this-is-a-test-post-to-try-out-posts","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2017-01-31T07:55:58.407Z","last_posted_at":"2017-01-31T07:55:58.634Z","bumped":true,"bumped_at":"2017-01-31T07:55:58.634Z","unseen":false,"last_read_post_number":1,"unread":0,"new_posts":0,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"notification_level":3,"bookmarked":false,"liked":false,"archetype":"regular","like_count":0,"views":1,"category_id":1,"featured_link":null,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user":{"id":1,"username":"tgx","avatar_template":"/images/avatar.png"}}]}],"notification_level":3,"notifications_reason_id":1,"can_move_posts":true,"can_edit":true,"can_delete":true,"can_recover":true,"can_remove_allowed_users":true,"can_invite_to":true,"can_create_post":true,"can_reply_as_new_topic":true,"can_flag_topic":true},"highest_post_number":1,"last_read_post_number":1,"last_read_post_id":15,"deleted_by":null,"has_deleted":false,"actions_summary":[{"id":4,"count":0,"hidden":false,"can_act":true},{"id":7,"count":0,"hidden":false,"can_act":true},{"id":8,"count":0,"hidden":false,"can_act":true}],"chunk_size":20,"bookmarked":false,"featured_link":null}
- ]
+ ];
});
server.get('/polls/voters.json', request => {
@@ -50,13 +50,13 @@ test("Public poll", () => {
andThen(() => {
const polls = find('.poll');
- equal(polls.length, 1, 'it should render the poll correctly');
+ assert.equal(polls.length, 1, 'it should render the poll correctly');
});
click('button.toggle-results');
andThen(() => {
- equal(
+ assert.equal(
find('.poll-voters:first li').length, 25,
'it should display the right number of voters'
);
@@ -65,20 +65,20 @@ test("Public poll", () => {
click('.poll-voters-toggle-expand:first a');
andThen(() => {
- equal(
+ assert.equal(
find('.poll-voters:first li').length, 50,
'it should display the right number of voters'
- )
+ );
});
});
-test("Public number poll", () => {
+test("Public number poll", assert => {
server.get('/t/13.json', () => {
return [
200,
{ "Content-Type": "application/json" },
{"post_stream":{"posts":[{"id":16,"name":null,"username":"tgx","avatar_template":"/images/avatar.png","created_at":"2017-01-31T09:11:11.281Z","cooked":"
");
});
click('#reply-control .btn.create');
andThen(() => {
- equal(find('.topic-post:last .cooked p').html().trim(), "this is a category hashtag #bug");
+ assert.equal(find('.topic-post:last .cooked p').html().trim(), "this is a category hashtag #bug");
});
-});
+});
\ No newline at end of file
diff --git a/test/javascripts/acceptance/composer-test.js.es6 b/test/javascripts/acceptance/composer-test.js.es6
index fe086a68058..b155418b78e 100644
--- a/test/javascripts/acceptance/composer-test.js.es6
+++ b/test/javascripts/acceptance/composer-test.js.es6
@@ -7,44 +7,44 @@ acceptance("Composer", {
}
});
-test("Tests the Composer controls", () => {
+QUnit.test("Tests the Composer controls", assert => {
visit("/");
andThen(() => {
- ok(exists('#create-topic'), 'the create button is visible');
+ assert.ok(exists('#create-topic'), 'the create button is visible');
});
click('#create-topic');
andThen(() => {
- ok(exists('.d-editor-input'), 'the composer input is visible');
- ok(exists('.title-input .popup-tip.bad.hide'), 'title errors are hidden by default');
- ok(exists('.d-editor-textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default');
+ assert.ok(exists('.d-editor-input'), 'the composer input is visible');
+ assert.ok(exists('.title-input .popup-tip.bad.hide'), 'title errors are hidden by default');
+ assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default');
});
click('a.toggle-preview');
andThen(() => {
- ok(!exists('.d-editor-preview:visible'), "clicking the toggle hides the preview");
+ assert.ok(!exists('.d-editor-preview:visible'), "clicking the toggle hides the preview");
});
click('a.toggle-preview');
andThen(() => {
- ok(exists('.d-editor-preview:visible'), "clicking the toggle shows the preview again");
+ assert.ok(exists('.d-editor-preview:visible'), "clicking the toggle shows the preview again");
});
click('#reply-control button.create');
andThen(() => {
- ok(!exists('.title-input .popup-tip.bad.hide'), 'it shows the empty title error');
- ok(!exists('.d-editor-wrapper .popup-tip.bad.hide'), 'it shows the empty body error');
+ assert.ok(!exists('.title-input .popup-tip.bad.hide'), 'it shows the empty title error');
+ assert.ok(!exists('.d-editor-wrapper .popup-tip.bad.hide'), 'it shows the empty body error');
});
fillIn('#reply-title', "this is my new topic title");
andThen(() => {
- ok(exists('.title-input .popup-tip.good'), 'the title is now good');
+ assert.ok(exists('.title-input .popup-tip.good'), 'the title is now good');
});
fillIn('.d-editor-input', "this is the *content* of a post");
andThen(() => {
- equal(find('.d-editor-preview').html().trim(), "
this is the content of a post
", "it previews content");
- ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
+ assert.equal(find('.d-editor-preview').html().trim(), "
this is the content of a post
", "it previews content");
+ assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
});
andThen(() => {
@@ -64,89 +64,89 @@ test("Tests the Composer controls", () => {
andThen(() => {
const example = I18n.t(`composer.bold_text`);
- equal(find('#reply-control .d-editor-input').val().trim(),
+ assert.equal(find('#reply-control .d-editor-input').val().trim(),
`this is the *content* of a post**${example}**`,
"it supports keyboard shortcuts");
});
click('#reply-control a.cancel');
andThen(() => {
- ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
+ assert.ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
});
click('.modal-footer a:eq(1)');
andThen(() => {
- ok(!exists('.bootbox.modal'), 'the confirmation can be cancelled');
+ assert.ok(!exists('.bootbox.modal'), 'the confirmation can be cancelled');
});
});
-test("Create a topic with server side errors", () => {
+QUnit.test("Create a topic with server side errors", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "this title triggers an error");
fillIn('.d-editor-input', "this is the *content* of a post");
click('#reply-control button.create');
andThen(() => {
- ok(exists('.bootbox.modal'), 'it pops up an error message');
+ assert.ok(exists('.bootbox.modal'), 'it pops up an error message');
});
click('.bootbox.modal a.btn-primary');
andThen(() => {
- ok(!exists('.bootbox.modal'), 'it dismisses the error');
- ok(exists('.d-editor-input'), 'the composer input is visible');
+ assert.ok(!exists('.bootbox.modal'), 'it dismisses the error');
+ assert.ok(exists('.d-editor-input'), 'the composer input is visible');
});
});
-test("Create a Topic", () => {
+QUnit.test("Create a Topic", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "Internationalization Localization");
fillIn('.d-editor-input', "this is the *content* of a new topic post");
click('#reply-control button.create');
andThen(() => {
- equal(currentURL(), "/t/internationalization-localization/280", "it transitions to the newly created topic URL");
+ assert.equal(currentURL(), "/t/internationalization-localization/280", "it transitions to the newly created topic URL");
});
});
-test("Create an enqueued Topic", () => {
+QUnit.test("Create an enqueued Topic", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "Internationalization Localization");
fillIn('.d-editor-input', "enqueue this content please");
click('#reply-control button.create');
andThen(() => {
- ok(visible('#discourse-modal'), 'it pops up a modal');
- equal(currentURL(), "/", "it doesn't change routes");
+ assert.ok(visible('#discourse-modal'), 'it pops up a modal');
+ assert.equal(currentURL(), "/", "it doesn't change routes");
});
click('.modal-footer button');
andThen(() => {
- ok(invisible('#discourse-modal'), 'the modal can be dismissed');
+ assert.ok(invisible('#discourse-modal'), 'the modal can be dismissed');
});
});
-test("Create a Reply", () => {
+QUnit.test("Create a Reply", assert => {
visit("/t/internationalization-localization/280");
andThen(() => {
- ok(!exists('article[data-post-id=12345]'), 'the post is not in the DOM');
+ assert.ok(!exists('article[data-post-id=12345]'), 'the post is not in the DOM');
});
click('#topic-footer-buttons .btn.create');
andThen(() => {
- ok(exists('.d-editor-input'), 'the composer input is visible');
- ok(!exists('#reply-title'), 'there is no title since this is a reply');
+ assert.ok(exists('.d-editor-input'), 'the composer input is visible');
+ assert.ok(!exists('#reply-title'), 'there is no title since this is a reply');
});
fillIn('.d-editor-input', 'this is the content of my reply');
click('#reply-control button.create');
andThen(() => {
- equal(find('.cooked:last p').text(), 'this is the content of my reply');
+ assert.equal(find('.cooked:last p').text(), 'this is the content of my reply');
});
});
-test("Posting on a different topic", (assert) => {
+QUnit.test("Posting on a different topic", (assert) => {
visit("/t/internationalization-localization/280");
click('#topic-footer-buttons .btn.create');
fillIn('.d-editor-input', 'this is the content for a different topic');
@@ -167,106 +167,106 @@ test("Posting on a different topic", (assert) => {
});
-test("Create an enqueued Reply", () => {
+QUnit.test("Create an enqueued Reply", assert => {
visit("/t/internationalization-localization/280");
click('#topic-footer-buttons .btn.create');
andThen(() => {
- ok(exists('.d-editor-input'), 'the composer input is visible');
- ok(!exists('#reply-title'), 'there is no title since this is a reply');
+ assert.ok(exists('.d-editor-input'), 'the composer input is visible');
+ assert.ok(!exists('#reply-title'), 'there is no title since this is a reply');
});
fillIn('.d-editor-input', 'enqueue this content please');
click('#reply-control button.create');
andThen(() => {
- ok(find('.cooked:last p').text() !== 'enqueue this content please', "it doesn't insert the post");
+ assert.ok(find('.cooked:last p').text() !== 'enqueue this content please', "it doesn't insert the post");
});
andThen(() => {
- ok(visible('#discourse-modal'), 'it pops up a modal');
+ assert.ok(visible('#discourse-modal'), 'it pops up a modal');
});
click('.modal-footer button');
andThen(() => {
- ok(invisible('#discourse-modal'), 'the modal can be dismissed');
+ assert.ok(invisible('#discourse-modal'), 'the modal can be dismissed');
});
});
-test("Edit the first post", () => {
+QUnit.test("Edit the first post", assert => {
visit("/t/internationalization-localization/280");
- ok(!exists('.topic-post:eq(0) .post-info.edits'), 'it has no edits icon at first');
+ assert.ok(!exists('.topic-post:eq(0) .post-info.edits'), 'it has no edits icon at first');
click('.topic-post:eq(0) button.show-more-actions');
click('.topic-post:eq(0) button.edit');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('Any plans to support'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('Any plans to support'), 0, 'it populates the input with the post text');
});
fillIn('.d-editor-input', "This is the new text for the post");
fillIn('#reply-title', "This is the new text for the title");
click('#reply-control button.create');
andThen(() => {
- ok(!exists('.d-editor-input'), 'it closes the composer');
- ok(exists('.topic-post:eq(0) .post-info.edits'), 'it has the edits icon');
- ok(find('#topic-title h1').text().indexOf('This is the new text for the title') !== -1, 'it shows the new title');
- ok(find('.topic-post:eq(0) .cooked').text().indexOf('This is the new text for the post') !== -1, 'it updates the post');
+ assert.ok(!exists('.d-editor-input'), 'it closes the composer');
+ assert.ok(exists('.topic-post:eq(0) .post-info.edits'), 'it has the edits icon');
+ assert.ok(find('#topic-title h1').text().indexOf('This is the new text for the title') !== -1, 'it shows the new title');
+ assert.ok(find('.topic-post:eq(0) .cooked').text().indexOf('This is the new text for the post') !== -1, 'it updates the post');
});
});
-test("Composer can switch between edits", () => {
+QUnit.test("Composer can switch between edits", assert => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.edit');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
click('.topic-post:eq(1) button.edit');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
});
});
-test("Composer with dirty edit can toggle to another edit", () => {
+QUnit.test("Composer with dirty edit can toggle to another edit", assert => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.edit');
fillIn('.d-editor-input', 'This is a dirty reply');
click('.topic-post:eq(1) button.edit');
andThen(() => {
- ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
+ assert.ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
});
click('.modal-footer a:eq(0)');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
});
});
-test("Composer can toggle between edit and reply", () => {
+QUnit.test("Composer can toggle between edit and reply", assert => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.edit');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
click('.topic-post:eq(0) button.reply');
andThen(() => {
- equal(find('.d-editor-input').val(), "", 'it clears the input');
+ assert.equal(find('.d-editor-input').val(), "", 'it clears the input');
});
click('.topic-post:eq(0) button.edit');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
});
-test("Composer can toggle between reply and createTopic", () => {
+QUnit.test("Composer can toggle between reply and createTopic", assert => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.reply');
click('button.options');
click('.popup-menu .fa-eye-slash');
andThen(() => {
- ok(
+ assert.ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0,
'it sets the post type to whisper'
);
@@ -274,12 +274,12 @@ test("Composer can toggle between reply and createTopic", () => {
visit("/");
andThen(() => {
- ok(exists('#create-topic'), 'the create topic button is visible');
+ assert.ok(exists('#create-topic'), 'the create topic button is visible');
});
click('#create-topic');
andThen(() => {
- ok(
+ assert.ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) === -1,
"it should reset the state of the composer's model"
);
@@ -288,7 +288,7 @@ test("Composer can toggle between reply and createTopic", () => {
click('button.options');
click('.popup-menu .fa-eye-slash');
andThen(() => {
- ok(
+ assert.ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.unlist")) > 0,
'it sets the topic to unlisted'
);
@@ -298,29 +298,29 @@ test("Composer can toggle between reply and createTopic", () => {
click('.topic-post:eq(0) button.reply');
andThen(() => {
- ok(
+ assert.ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.unlist")) === -1,
"it should reset the state of the composer's model"
);
});
});
-test("Composer with dirty reply can toggle to edit", () => {
+QUnit.test("Composer with dirty reply can toggle to edit", assert => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.reply');
fillIn('.d-editor-input', 'This is a dirty reply');
click('.topic-post:eq(0) button.edit');
andThen(() => {
- ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
+ assert.ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
});
click('.modal-footer a:eq(0)');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
});
-test("Composer draft with dirty reply can toggle to edit", () => {
+QUnit.test("Composer draft with dirty reply can toggle to edit", assert => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.reply');
@@ -328,10 +328,10 @@ test("Composer draft with dirty reply can toggle to edit", () => {
click('.toggler');
click('.topic-post:eq(0) button.edit');
andThen(() => {
- ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
+ assert.ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
});
click('.modal-footer a:eq(0)');
andThen(() => {
- equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
+ assert.equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
-});
+});
\ No newline at end of file
diff --git a/test/javascripts/acceptance/composer-topic-links-test.js.es6 b/test/javascripts/acceptance/composer-topic-links-test.js.es6
index 3876fcc5cc8..515e01f111b 100644
--- a/test/javascripts/acceptance/composer-topic-links-test.js.es6
+++ b/test/javascripts/acceptance/composer-topic-links-test.js.es6
@@ -9,58 +9,58 @@ acceptance("Composer topic featured links", {
});
-test("onebox with title", () => {
+QUnit.test("onebox with title", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "http://www.example.com/has-title.html");
andThen(() => {
- ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
- ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
- equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article");
+ assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
+ assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
+ assert.equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article");
});
});
-test("onebox result doesn't include a title", () => {
+QUnit.test("onebox result doesn't include a title", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', 'http://www.example.com/no-title.html');
andThen(() => {
- ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
- ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
- equal(find('.title-input input').val(), "http://www.example.com/no-title.html", "title is unchanged");
+ assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
+ assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
+ assert.equal(find('.title-input input').val(), "http://www.example.com/no-title.html", "title is unchanged");
});
});
-test("no onebox result", () => {
+QUnit.test("no onebox result", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "http://www.example.com/nope-onebox.html");
andThen(() => {
- ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
- ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'link is pasted into body');
- equal(find('.title-input input').val(), "http://www.example.com/nope-onebox.html", "title is unchanged");
+ assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
+ assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'link is pasted into body');
+ assert.equal(find('.title-input input').val(), "http://www.example.com/nope-onebox.html", "title is unchanged");
});
});
-test("ignore internal links", () => {
+QUnit.test("ignore internal links", assert => {
visit("/");
click('#create-topic');
const title = "http://" + window.location.hostname + "/internal-page.html";
fillIn('#reply-title', title);
andThen(() => {
- equal(find('.d-editor-preview').html().trim().indexOf('onebox'), -1, "onebox preview doesn't show");
- equal(find('.d-editor-input').val().length, 0, "link isn't put into the post");
- equal(find('.title-input input').val(), title, "title is unchanged");
+ assert.equal(find('.d-editor-preview').html().trim().indexOf('onebox'), -1, "onebox preview doesn't show");
+ assert.equal(find('.d-editor-input').val().length, 0, "link isn't put into the post");
+ assert.equal(find('.title-input input').val(), title, "title is unchanged");
});
});
-test("link is longer than max title length", () => {
+QUnit.test("link is longer than max title length", assert => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "http://www.example.com/has-title-and-a-url-that-is-more-than-80-characters-because-thats-good-for-seo-i-guess.html");
andThen(() => {
- ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
- ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
- equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article");
+ assert.ok(find('.d-editor-preview').html().trim().indexOf('onebox') > 0, "it pastes the link into the body and previews it");
+ assert.ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
+ assert.equal(find('.title-input input').val(), "An interesting article", "title is from the oneboxed article");
});
-});
+});
\ No newline at end of file
diff --git a/test/javascripts/acceptance/create-account-user-fields-test.js.es6 b/test/javascripts/acceptance/create-account-user-fields-test.js.es6
index 0b6fec4da4e..cb7a2fe5c56 100644
--- a/test/javascripts/acceptance/create-account-user-fields-test.js.es6
+++ b/test/javascripts/acceptance/create-account-user-fields-test.js.es6
@@ -8,14 +8,14 @@ acceptance("Create Account - User Fields", {
}
});
-test("create account with user fields", () => {
+QUnit.test("create account with user fields", assert => {
visit("/");
click("header .sign-up-button");
andThen(() => {
- ok(exists('.create-account'), "it shows the create account modal");
- ok(exists('.user-field'), "it has at least one user field");
- ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled at first');
+ assert.ok(exists('.create-account'), "it shows the create account modal");
+ assert.ok(exists('.user-field'), "it has at least one user field");
+ assert.ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled at first');
});
fillIn('#new-account-name', 'Dr. Good Tuna');
@@ -24,24 +24,24 @@ test("create account with user fields", () => {
fillIn('#new-account-username', 'goodtuna');
andThen(() => {
- ok(exists('#username-validation.good'), 'the username validation is good');
- ok(exists('.modal-footer .btn-primary:disabled'), 'create account is still disabled due to lack of user fields');
+ assert.ok(exists('#username-validation.good'), 'the username validation is good');
+ assert.ok(exists('.modal-footer .btn-primary:disabled'), 'create account is still disabled due to lack of user fields');
});
fillIn(".user-field input[type=text]:first", "Barky");
andThen(() => {
- ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled because field is not checked');
+ assert.ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled because field is not checked');
});
click(".user-field input[type=checkbox]");
andThen(() => {
- not(exists('.modal-footer .btn-primary:disabled'), 'create account is enabled because field is not checked');
+ assert.not(exists('.modal-footer .btn-primary:disabled'), 'create account is enabled because field is not checked');
});
click(".user-field input[type=checkbox]");
andThen(() => {
- ok(exists('.modal-footer .btn-primary:disabled'), 'unclicking the checkbox disables the submit');
+ assert.ok(exists('.modal-footer .btn-primary:disabled'), 'unclicking the checkbox disables the submit');
});
});
diff --git a/test/javascripts/acceptance/custom-html-set-test.js.es6 b/test/javascripts/acceptance/custom-html-set-test.js.es6
index 3ae0bd63737..6b2508ebf7f 100644
--- a/test/javascripts/acceptance/custom-html-set-test.js.es6
+++ b/test/javascripts/acceptance/custom-html-set-test.js.es6
@@ -4,14 +4,14 @@ import PreloadStore from 'preload-store';
acceptance("CustomHTML set");
-test("has no custom HTML in the top", assert => {
+QUnit.test("has no custom HTML in the top", assert => {
visit("/static/faq");
andThen(() => {
assert.ok(!exists('span.custom-html-test'), 'it has no markup');
});
});
-test("renders set HTML", assert => {
+QUnit.test("renders set HTML", assert => {
setCustomHTML('top', 'HTML');
visit("/static/faq");
@@ -20,11 +20,11 @@ test("renders set HTML", assert => {
});
});
-test("renders preloaded HTML", assert => {
+QUnit.test("renders preloaded HTML", assert => {
PreloadStore.store('customHTML', {top: "monster"});
visit("/static/faq");
andThen(() => {
assert.equal(find('span.cookie').text(), 'monster', 'it inserted the markup');
});
-});
+});
\ No newline at end of file
diff --git a/test/javascripts/acceptance/custom-html-template-test.js.es6 b/test/javascripts/acceptance/custom-html-template-test.js.es6
index d125236ebbc..bb0d77c8794 100644
--- a/test/javascripts/acceptance/custom-html-template-test.js.es6
+++ b/test/javascripts/acceptance/custom-html-template-test.js.es6
@@ -1,16 +1,16 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("CustomHTML template", {
- setup() {
+ beforeEach() {
Ember.TEMPLATES['top'] = Ember.HTMLBars.compile(`TOP`);
},
- teardown() {
+ afterEach() {
delete Ember.TEMPLATES['top'];
}
});
-test("renders custom template", assert => {
+QUnit.test("renders custom template", assert => {
visit("/static/faq");
andThen(() => {
assert.equal(find('span.top-span').text(), 'TOP', 'it inserted the template');
diff --git a/test/javascripts/acceptance/emoji-test.js.es6 b/test/javascripts/acceptance/emoji-test.js.es6
index dfcd95fb753..23fc2aa8046 100644
--- a/test/javascripts/acceptance/emoji-test.js.es6
+++ b/test/javascripts/acceptance/emoji-test.js.es6
@@ -2,32 +2,32 @@ import { acceptance } from "helpers/qunit-helpers";
acceptance("Emoji", { loggedIn: true });
-test("emoji is cooked properly", () => {
+QUnit.test("emoji is cooked properly", assert => {
visit("/t/internationalization-localization/280");
click('#topic-footer-buttons .btn.create');
fillIn('.d-editor-input', "this is an emoji :blonde_woman:");
andThen(() => {
- equal(find('.d-editor-preview:visible').html().trim(), "
',
"autolinks a URL with parentheses (like Wikipedia)");
- cooked("Here's a tweet:\nhttps://twitter.com/evil_trout/status/345954894420787200",
+ assert.cooked("Here's a tweet:\nhttps://twitter.com/evil_trout/status/345954894420787200",
"
",
"allows autolinking within a list without inserting a paragraph.");
- cooked("[3]: http://eviltrout.com", "", "It doesn't autolink markdown link references");
+ assert.cooked("[3]: http://eviltrout.com", "", "It doesn't autolink markdown link references");
- cooked("[]: http://eviltrout.com", "
", "It doesn't accept BBCode as link references");
+ assert.cooked("[b]label[/b]: description", "
label: description
", "It doesn't accept BBCode as link references");
- cooked("http://discourse.org and http://discourse.org/another_url and http://www.imdb.com/name/nm2225369",
+ assert.cooked("http://discourse.org and http://discourse.org/another_url and http://www.imdb.com/name/nm2225369",
"
",
"it supports markdown links where the name and link match");
- cooked("[Link](http://www.example.com) (with an outer \"description\")",
+ assert.cooked("[Link](http://www.example.com) (with an outer \"description\")",
"
",
"it doesn't consume closing parens as part of the url");
- cooked("A link inside parentheses (http://www.example.com)",
+ assert.cooked("A link inside parentheses (http://www.example.com)",
"
",
"should not do mentions within a code block.");
- cooked("> foo bar baz @eviltrout",
+ assert.cooked("> foo bar baz @eviltrout",
"
foo bar baz @eviltrout
",
"handles mentions in simple quotes");
- cooked("> foo bar baz @eviltrout ohmagerd\nlook at this",
+ assert.cooked("> foo bar baz @eviltrout ohmagerd\nlook at this",
"
foo bar baz @eviltrout ohmagerd look at this
",
"does mentions properly with trailing text within a simple quote");
- cooked("`code` is okay before @mention",
+ assert.cooked("`code` is okay before @mention",
"
code is okay before @mention
",
"Does not mention in an inline code block");
- cooked("@mention is okay before `code`",
+ assert.cooked("@mention is okay before `code`",
"
@mention is okay before code
",
"Does not mention in an inline code block");
- cooked("don't `@mention`",
+ assert.cooked("don't `@mention`",
"
don't @mention
",
"Does not mention in an inline code block");
- cooked("Yes `@this` should be code @eviltrout",
+ assert.cooked("Yes `@this` should be code @eviltrout",
"
Yes @this should be code @eviltrout
",
"Does not mention in an inline code block");
- cooked("@eviltrout and `@eviltrout`",
+ assert.cooked("@eviltrout and `@eviltrout`",
"
@eviltrout and @eviltrout
",
"you can have a mention in an inline code block following a real mention.");
- cooked("1. this is a list\n\n2. this is an @eviltrout mention\n",
+ assert.cooked("1. this is a list\n\n2. this is an @eviltrout mention\n",
"
this is a list
this is an @eviltrout mention
",
"it mentions properly in a list.");
- cooked("Hello @foo/@bar",
+ assert.cooked("Hello @foo/@bar",
"
Hello @foo/@bar
",
"handles mentions separated by a slash.");
- cookedOptions("@eviltrout", alwaysTrue,
+ assert.cookedOptions("@eviltrout", alwaysTrue,
"
",
"it translates category hashtag into links");
- cooked("Check out #category-hashtag",
+ assert.cooked("Check out #category-hashtag",
"
Check out #category-hashtag
",
"it does not translate category hashtag into links if it is not a valid category hashtag");
- cookedOptions("[#category-hashtag](http://www.test.com)", alwaysTrue,
+ assert.cookedOptions("[#category-hashtag](http://www.test.com)", alwaysTrue,
"
", "allows escaping em");
});
-test("New Lines", function() {
+QUnit.test("New Lines", assert => {
// Note: This behavior was discussed and we determined it does not make sense to do this
// unless you're using traditional line breaks
- cooked("_abc\ndef_", "
_abc def_
", "it does not allow markup to span new lines");
- cooked("_abc\n\ndef_", "
_abc
\n\n
def_
", "it does not allow markup to span new paragraphs");
+ assert.cooked("_abc\ndef_", "
_abc def_
", "it does not allow markup to span new lines");
+ assert.cooked("_abc\n\ndef_", "
_abc
\n\n
def_
", "it does not allow markup to span new paragraphs");
});
-test("Oneboxing", function() {
+QUnit.test("Oneboxing", assert => {
function matches(input, regexp) {
return new PrettyText(defaultOpts).cook(input).match(regexp);
};
- ok(!matches("- http://www.textfiles.com/bbs/MINDVOX/FORUMS/ethics\n\n- http://drupal.org", /onebox/),
+ assert.ok(!matches("- http://www.textfiles.com/bbs/MINDVOX/FORUMS/ethics\n\n- http://drupal.org", /onebox/),
"doesn't onebox a link within a list");
- ok(matches("http://test.com", /onebox/), "adds a onebox class to a link on its own line");
- ok(matches("http://test.com\nhttp://test2.com", /onebox[\s\S]+onebox/m), "supports multiple links");
- ok(!matches("http://test.com bob", /onebox/), "doesn't onebox links that have trailing text");
+ assert.ok(matches("http://test.com", /onebox/), "adds a onebox class to a link on its own line");
+ assert.ok(matches("http://test.com\nhttp://test2.com", /onebox[\s\S]+onebox/m), "supports multiple links");
+ assert.ok(!matches("http://test.com bob", /onebox/), "doesn't onebox links that have trailing text");
- ok(!matches("[Tom Cruise](http://www.tomcruise.com/)", "onebox"), "Markdown links with labels are not oneboxed");
- ok(matches("[http://www.tomcruise.com/](http://www.tomcruise.com/)",
+ assert.ok(!matches("[Tom Cruise](http://www.tomcruise.com/)", "onebox"), "Markdown links with labels are not oneboxed");
+ assert.ok(matches("[http://www.tomcruise.com/](http://www.tomcruise.com/)",
"onebox"),
"Markdown links where the label is the same as the url are oneboxed");
- cooked("http://en.wikipedia.org/wiki/Homicide:_Life_on_the_Street",
+ assert.cooked("http://en.wikipedia.org/wiki/Homicide:_Life_on_the_Street",
"
",
"works with links that have underscores in them");
});
-test("links with full urls", function() {
- cooked("[http://eviltrout.com][1] is a url\n\n[1]: http://eviltrout.com",
+QUnit.test("links with full urls", assert => {
+ assert.cooked("[http://eviltrout.com][1] is a url\n\n[1]: http://eviltrout.com",
"
",
"It does not truncate text after a code block.");
- cooked("```json\nline 1\n\nline 2\n\n\nline3\n```",
+ assert.cooked("```json\nline 1\n\nline 2\n\n\nline3\n```",
"
line 1\n\nline 2\n\n\nline3
",
"it maintains new lines inside a code block.");
- cooked("hello\nworld\n```json\nline 1\n\nline 2\n\n\nline3\n```",
+ assert.cooked("hello\nworld\n```json\nline 1\n\nline 2\n\n\nline3\n```",
"
hello world
\n\n
line 1\n\nline 2\n\n\nline3
",
"it maintains new lines inside a code block with leading content.");
- cooked("```ruby\nhello\n```",
+ assert.cooked("```ruby\nhello\n```",
"
<header>hello</header>
",
"it escapes code in the code block");
- cooked("```text\ntext\n```",
+ assert.cooked("```text\ntext\n```",
"
text
",
"handles text by adding nohighlight");
- cooked("```ruby\n# cool\n```",
+ assert.cooked("```ruby\n# cool\n```",
"
",
"only detect ``` at the beginning of lines");
- cooked("```ruby\ndef self.parse(text)\n\n text\nend\n```",
+ assert.cooked("```ruby\ndef self.parse(text)\n\n text\nend\n```",
"
def self.parse(text)\n\n text\nend
",
"it allows leading spaces on lines in a code block.");
- cooked("```ruby\nhello `eviltrout`\n```",
+ assert.cooked("```ruby\nhello `eviltrout`\n```",
"
hello `eviltrout`
",
"it allows code with backticks in it");
- cooked("```eviltrout\nhello\n```",
+ assert.cooked("```eviltrout\nhello\n```",
"
hello
",
"it doesn't not whitelist all classes");
- cooked("```\n[quote=\"sam, post:1, topic:9441, full:true\"]This is `` a bug.[/quote]\n```",
+ assert.cooked("```\n[quote=\"sam, post:1, topic:9441, full:true\"]This is `` a bug.[/quote]\n```",
"
[quote="sam, post:1, topic:9441, full:true"]This is `<not>` a bug.[/quote]
",
"it allows code with backticks in it");
- cooked(" hello\n
test
",
+ assert.cooked(" hello\n
test
",
"
hello
\n\n
test
",
"it allows an indented code block to by followed by a `
`");
- cooked("``` foo bar ```",
+ assert.cooked("``` foo bar ```",
"
foo bar
",
"it tolerates misuse of code block tags as inline code");
- cooked("```\nline1\n```\n```\nline2\n\nline3\n```",
+ assert.cooked("```\nline1\n```\n```\nline2\n\nline3\n```",
"
line1
\n\n
line2\n\nline3
",
"it does not consume next block's trailing newlines");
- cooked("
test
",
+ assert.cooked("
test
",
"
<pre>test</pre>
",
"it does not parse other block types in markdown code blocks");
- cooked(" [quote]test[/quote]",
+ assert.cooked(" [quote]test[/quote]",
"
[quote]test[/quote]
",
"it does not parse other block types in markdown code blocks");
- cooked("## a\nb\n```\nc\n```",
+ assert.cooked("## a\nb\n```\nc\n```",
"
a
\n\n
c
",
"it handles headings with code blocks after them.");
});
-test("URLs in BBCode tags", function() {
+QUnit.test("URLs in BBCode tags", assert => {
- cooked("[img]http://eviltrout.com/eviltrout.png[/img][img]http://samsaffron.com/samsaffron.png[/img]",
+ assert.cooked("[img]http://eviltrout.com/eviltrout.png[/img][img]http://samsaffron.com/samsaffron.png[/img]",
"
",
"images are properly parsed");
- cooked("[url]http://discourse.org[/url]",
+ assert.cooked("[url]http://discourse.org[/url]",
"
",
"it censors words in the Site Settings");
- cooked("you are a whizzard! I love cheesewhiz. Whiz.",
+ assert.cooked("you are a whizzard! I love cheesewhiz. Whiz.",
"
you are a whizzard! I love cheesewhiz. ■■■■.
",
"it doesn't censor words unless they have boundaries.");
- cooked("you are a whizzer! I love cheesewhiz. Whiz.",
+ assert.cooked("you are a whizzer! I love cheesewhiz. Whiz.",
"
you are a ■■■■■■■! I love cheesewhiz. ■■■■.
",
"it censors words even if previous partial matches exist.");
- cooked("The link still works. [whiz](http://www.whiz.com)",
+ assert.cooked("The link still works. [whiz](http://www.whiz.com)",
"
",
"it won't break links by censoring them.");
- cooked("Call techapj the computer whiz at 555-555-1234 for free help.",
+ assert.cooked("Call techapj the computer whiz at 555-555-1234 for free help.",
"
Call ■■■■■■■ the computer ■■■■ at 555-■■■■■■■■ for free help.
",
"uses both censored words and patterns from site settings");
- cooked("I have a pen, I have an a**le",
+ assert.cooked("I have a pen, I have an a**le",
"
", "creates an ul");
+ assert.cookedPara("[ol][li]option one[/li][/ol]", "
option one
", "creates an ol");
+ assert.cookedPara("[ul]\n[li]option one[/li]\n[li]option two[/li]\n[/ul]", "
option one
option two
", "suppresses empty lines in lists");
});
-test('tags with arguments', function() {
- cookedPara("[url=http://bettercallsaul.com]better call![/url]", "better call!", "supports [url] with a title");
- cookedPara("[email=eviltrout@mailinator.com]evil trout[/email]", "evil trout", "supports [email] with a title");
- cookedPara("[u][i]abc[/i][/u]", "abc", "can nest tags");
- cookedPara("[b]first[/b] [b]second[/b]", "firstsecond", "can bold two things on the same line");
+QUnit.test('tags with arguments', assert => {
+ assert.cookedPara("[url=http://bettercallsaul.com]better call![/url]", "better call!", "supports [url] with a title");
+ assert.cookedPara("[email=eviltrout@mailinator.com]evil trout[/email]", "evil trout", "supports [email] with a title");
+ assert.cookedPara("[u][i]abc[/i][/u]", "abc", "can nest tags");
+ assert.cookedPara("[b]first[/b] [b]second[/b]", "firstsecond", "can bold two things on the same line");
});
-test("quotes", function() {
+QUnit.test("quotes", assert => {
const post = Post.create({
cooked: "
lorem ipsum
",
username: "eviltrout",
@@ -621,7 +633,7 @@ test("quotes", function() {
});
function formatQuote(val, expected, text) {
- equal(Quote.build(post, val), expected, text);
+ assert.equal(Quote.build(post, val), expected, text);
};
formatQuote(undefined, "", "empty string for undefined content");
@@ -646,80 +658,80 @@ test("quotes", function() {
"[quote=\"eviltrout, post:1, topic:2\"]\nthis is <not> a bug\n[/quote]\n\n",
"it escapes the contents of the quote");
- cookedPara("[quote]test[/quote]",
+ assert.cookedPara("[quote]test[/quote]",
"",
"it supports quotes without params");
- cookedPara("[quote]\n*test*\n[/quote]",
+ assert.cookedPara("[quote]\n*test*\n[/quote]",
"",
"it doesn't insert a new line for italics");
- cookedPara("[quote=,script='a'>