FEATURE: Replace composer editor with ember version

This commit is contained in:
Robin Ward
2015-11-03 16:25:37 -05:00
parent fc27b7442f
commit 47495a5713
51 changed files with 771 additions and 3420 deletions

View File

@ -10,25 +10,25 @@ test("Tests the Composer controls", () => {
click('#create-topic');
andThen(() => {
ok(exists('.wmd-input'), 'the composer input is visible');
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('.textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default');
ok(exists('.d-editor-textarea-wrapper .popup-tip.bad.hide'), 'body errors are hidden by default');
});
click('a.toggle-preview');
andThen(() => {
ok(!exists('.wmd-preview:visible'), "clicking the toggle hides the preview");
ok(!exists('.d-editor-preview:visible'), "clicking the toggle hides the preview");
});
click('a.toggle-preview');
andThen(() => {
ok(exists('.wmd-preview:visible'), "clicking the toggle shows the preview again");
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('.textarea-wrapper .popup-tip.bad.hide'), 'it shows the empty body error');
ok(!exists('.d-editor-wrapper .popup-tip.bad.hide'), 'it shows the empty body error');
});
fillIn('#reply-title', "this is my new topic title");
@ -36,10 +36,10 @@ test("Tests the Composer controls", () => {
ok(exists('.title-input .popup-tip.good'), 'the title is now good');
});
fillIn('.wmd-input', "this is the *content* of a post");
fillIn('.d-editor-input', "this is the *content* of a post");
andThen(() => {
equal(find('.wmd-preview').html(), "<p>this is the <em>content</em> of a post</p>", "it previews content");
ok(exists('.textarea-wrapper .popup-tip.good'), 'the body is now good');
equal(find('.d-editor-preview').html().trim(), "<p>this is the <em>content</em> of a post</p>", "it previews content");
ok(exists('.d-editor-textarea-wrapper .popup-tip.good'), 'the body is now good');
});
click('#reply-control a.cancel');
@ -58,7 +58,7 @@ test("Create a topic with server side errors", () => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "this title triggers an error");
fillIn('.wmd-input', "this is the *content* of a post");
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');
@ -66,7 +66,7 @@ test("Create a topic with server side errors", () => {
click('.bootbox.modal a.btn-primary');
andThen(() => {
ok(!exists('.bootbox.modal'), 'it dismisses the error');
ok(exists('.wmd-input'), 'the composer input is visible');
ok(exists('.d-editor-input'), 'the composer input is visible');
});
});
@ -74,7 +74,7 @@ test("Create a Topic", () => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "Internationalization Localization");
fillIn('.wmd-input', "this is the *content* of a new topic post");
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");
@ -85,7 +85,7 @@ test("Create an enqueued Topic", () => {
visit("/");
click('#create-topic');
fillIn('#reply-title', "Internationalization Localization");
fillIn('.wmd-input', "enqueue this content please");
fillIn('.d-editor-input', "enqueue this content please");
click('#reply-control button.create');
andThen(() => {
ok(visible('#discourse-modal'), 'it pops up a modal');
@ -108,11 +108,11 @@ test("Create a Reply", () => {
click('#topic-footer-buttons .btn.create');
andThen(() => {
ok(exists('.wmd-input'), 'the composer input is visible');
ok(exists('.d-editor-input'), 'the composer input is visible');
ok(!exists('#reply-title'), 'there is no title since this is a reply');
});
fillIn('.wmd-input', 'this is the content of my 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');
@ -122,7 +122,7 @@ test("Create a Reply", () => {
test("Posting on a different topic", (assert) => {
visit("/t/internationalization-localization/280");
click('#topic-footer-buttons .btn.create');
fillIn('.wmd-input', 'this is the content for a different topic');
fillIn('.d-editor-input', 'this is the content for a different topic');
visit("/t/1-3-0beta9-no-rate-limit-popups/28830");
andThen(function() {
@ -145,11 +145,11 @@ test("Create an enqueued Reply", () => {
click('#topic-footer-buttons .btn.create');
andThen(() => {
ok(exists('.wmd-input'), 'the composer input is visible');
ok(exists('.d-editor-input'), 'the composer input is visible');
ok(!exists('#reply-title'), 'there is no title since this is a reply');
});
fillIn('.wmd-input', 'enqueue this content please');
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");
@ -173,14 +173,14 @@ test("Edit the first post", () => {
click('.topic-post:eq(0) button[data-action=showMoreActions]');
click('.topic-post:eq(0) button[data-action=edit]');
andThen(() => {
equal(find('.wmd-input').val().indexOf('Any plans to support'), 0, 'it populates the input with the post text');
equal(find('.d-editor-input').val().indexOf('Any plans to support'), 0, 'it populates the input with the post text');
});
fillIn('.wmd-input', "This is the new text for the post");
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('.wmd-input'), 'it closes the composer');
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');
@ -192,11 +192,11 @@ test("Composer can switch between edits", () => {
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');
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[data-action=edit]');
andThen(() => {
equal(find('.wmd-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
equal(find('.d-editor-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
});
});
@ -204,14 +204,14 @@ test("Composer with dirty edit can toggle to another edit", () => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button[data-action=edit]');
fillIn('.wmd-input', 'This is a dirty reply');
fillIn('.d-editor-input', 'This is a dirty reply');
click('.topic-post:eq(1) 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 second post.'), 0, 'it populates the input with the post text');
equal(find('.d-editor-input').val().indexOf('This is the second post.'), 0, 'it populates the input with the post text');
});
});
@ -220,15 +220,15 @@ test("Composer can toggle between edit and reply", () => {
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');
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[data-action=reply]');
andThen(() => {
equal(find('.wmd-input').val(), "", 'it clears the input');
equal(find('.d-editor-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');
equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
});
@ -236,14 +236,14 @@ 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');
fillIn('.d-editor-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');
equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
});
@ -251,7 +251,7 @@ 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');
fillIn('.d-editor-input', 'This is a dirty reply');
click('.toggler');
click('.topic-post:eq(0) button[data-action=edit]');
andThen(() => {
@ -259,6 +259,6 @@ test("Composer draft with dirty reply can toggle to edit", () => {
});
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');
equal(find('.d-editor-input').val().indexOf('This is the first post.'), 0, 'it populates the input with the post text');
});
});