mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
Add more acceptance tests for composer.
This commit is contained in:
parent
9fbab34e57
commit
5e215a87c2
@ -187,3 +187,63 @@ test("Edit the first post", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Composer can switch between edits", () => {
|
||||||
|
visit("/t/this-is-a-test-topic/9");
|
||||||
|
|
||||||
|
click('.topic-post:eq(0) button[data-action=edit]');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
|
||||||
|
});
|
||||||
|
click('.topic-post:eq(1) button[data-action=edit]');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-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", () => {
|
||||||
|
visit("/t/this-is-a-test-topic/9");
|
||||||
|
|
||||||
|
click('.topic-post:eq(0) button[data-action=edit]');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
|
||||||
|
});
|
||||||
|
click('.topic-post:eq(0) button[data-action=reply]');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-input').val(), "", 'it clears the input');
|
||||||
|
});
|
||||||
|
click('.topic-post:eq(0) button[data-action=edit]');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Composer with dirty reply can toggle to edit", () => {
|
||||||
|
visit("/t/this-is-a-test-topic/9");
|
||||||
|
|
||||||
|
click('.topic-post:eq(0) button[data-action=reply]');
|
||||||
|
fillIn('.wmd-input', 'This is a dirty reply');
|
||||||
|
click('.topic-post:eq(0) button[data-action=edit]');
|
||||||
|
andThen(() => {
|
||||||
|
ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
|
||||||
|
});
|
||||||
|
click('.modal-footer a:eq(0)');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-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", () => {
|
||||||
|
visit("/t/this-is-a-test-topic/9");
|
||||||
|
|
||||||
|
click('.topic-post:eq(0) button[data-action=reply]');
|
||||||
|
fillIn('.wmd-input', 'This is a dirty reply');
|
||||||
|
click('.toggler');
|
||||||
|
click('.topic-post:eq(0) button[data-action=edit]');
|
||||||
|
andThen(() => {
|
||||||
|
ok(exists('.bootbox.modal'), 'it pops up a confirmation dialog');
|
||||||
|
});
|
||||||
|
click('.modal-footer a:eq(0)');
|
||||||
|
andThen(() => {
|
||||||
|
equal(find('.wmd-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
"/posts/398": {"id":398,"name":"Uwe Keim","username":"uwe_keim","avatar_template":"/user_avatar/meta.discourse.org/uwe_keim/{size}/5697.png","uploaded_avatar_id":5697,"created_at":"2013-02-05T21:29:00.280Z","cooked":"<p>Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?</p>","post_number":1,"post_type":1,"updated_at":"2013-02-05T21:29:00.280Z","like_count":0,"reply_count":1,"reply_to_post_number":null,"quote_count":0,"avg_time":25,"incoming_link_count":314,"reads":475,"score":1702.25,"yours":false,"topic_id":280,"topic_slug":"internationalization-localization","display_username":"Uwe Keim","primary_group_name":null,"version":1,"can_edit":true,"can_delete":false,"can_recover":true,"user_title":null,"raw":"Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?","actions_summary":[{"id":2,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":3,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":4,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":5,"count":0,"hidden":true,"can_act":true,"can_defer_flags":false},{"id":6,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":7,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":8,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false}],"moderator":false,"admin":false,"staff":false,"user_id":255,"hidden":false,"hidden_reason_id":null,"trust_level":2,"deleted_at":null,"user_deleted":false,"edit_reason":null,"can_view_edit_history":true,"wiki":false}
|
"/posts/398": {"id":398,"name":"Uwe Keim","username":"uwe_keim","avatar_template":"/user_avatar/meta.discourse.org/uwe_keim/{size}/5697.png","uploaded_avatar_id":5697,"created_at":"2013-02-05T21:29:00.280Z","cooked":"<p>Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?</p>","post_number":1,"post_type":1,"updated_at":"2013-02-05T21:29:00.280Z","like_count":0,"reply_count":1,"reply_to_post_number":null,"quote_count":0,"avg_time":25,"incoming_link_count":314,"reads":475,"score":1702.25,"yours":false,"topic_id":280,"topic_slug":"internationalization-localization","display_username":"Uwe Keim","primary_group_name":null,"version":1,"can_edit":true,"can_delete":false,"can_recover":true,"user_title":null,"raw":"Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?","actions_summary":[{"id":2,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":3,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":4,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":5,"count":0,"hidden":true,"can_act":true,"can_defer_flags":false},{"id":6,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":7,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false},{"id":8,"count":0,"hidden":false,"can_act":true,"can_defer_flags":false}],"moderator":false,"admin":false,"staff":false,"user_id":255,"hidden":false,"hidden_reason_id":null,"trust_level":2,"deleted_at":null,"user_deleted":false,"edit_reason":null,"can_view_edit_history":true,"wiki":false},
|
||||||
|
"/posts/18": {"id":18,"username":"eviltrout","avatar_template":"//www.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9.png?s={size}&r=pg&d=identicon","name":"Evil Trout","uploaded_avatar_id":9,"created_at":"2015-08-13T14:49:11.840Z","cooked":"<p>This is the first post.</p>","post_number":1,"post_type":1,"updated_at":"2015-08-13T14:49:11.840Z","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":9,"topic_slug":"this-is-a-test-topic","display_username":"","primary_group_name":null,"version":1,"can_edit":true,"can_delete":false,"can_recover":true,"user_title":null,"raw":"This is the first post.","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},
|
||||||
|
"/posts/19": {"id":19,"username":"eviltrout","avatar_template":"//www.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9.png?s={size}&r=pg&d=identicon","name":"Evil Trout","uploaded_avatar_id":9,"created_at":"2015-08-13T14:49:18.231Z","cooked":"<p>This is the second post.</p>","post_number":2,"post_type":1,"updated_at":"2015-08-13T14:49:18.231Z","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":9,"topic_slug":"this-is-a-test-topic","display_username":"","primary_group_name":null,"version":1,"can_edit":true,"can_delete":true,"can_recover":true,"read":true,"user_title":null,"raw":"This is the second post.","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}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -107,6 +107,10 @@ export default function() {
|
|||||||
return response(fixturesByUrl['/t/28830/1.json']);
|
return response(fixturesByUrl['/t/28830/1.json']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.get("/t/9.json", function() {
|
||||||
|
return response(fixturesByUrl['/t/9/1.json']);
|
||||||
|
});
|
||||||
|
|
||||||
this.get("/t/id_for/:slug", function() {
|
this.get("/t/id_for/:slug", function() {
|
||||||
return response({id: 280, slug: "internationalization-localization", url: "/t/internationalization-localization/280"});
|
return response({id: 280, slug: "internationalization-localization", url: "/t/internationalization-localization/280"});
|
||||||
});
|
});
|
||||||
@ -116,6 +120,7 @@ export default function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.delete('/draft.json', success);
|
this.delete('/draft.json', success);
|
||||||
|
this.post('/draft.json', success);
|
||||||
|
|
||||||
this.get('/users/:username/staff-info.json', () => response({}));
|
this.get('/users/:username/staff-info.json', () => response({}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user