FIX: ensures toolbar is updated on composer action change (#9402)

This commit is contained in:
Joffrey JAFFEUX 2020-04-10 22:39:19 +02:00 committed by GitHub
parent 5471c065cd
commit d984848aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -328,7 +328,7 @@ export default Component.extend({
$(this.element.querySelector(".d-editor-preview")).off("click.preview");
},
@discourseComputed
@discourseComputed("attrs.outletArgs.composer.action")
toolbar() {
const toolbar = new Toolbar(
this.getProperties("site", "siteSettings", "showLink")

View File

@ -584,7 +584,7 @@ testCase(`list button with line sequence`, async function(assert, textarea) {
assert.equal(textarea.selectionEnd, 18);
});
componentTest("clicking the toggle-direction button toggles the direction", {
componentTest("clicking the toggle-direction changes dir from ltr to rtl", {
template: "{{d-editor value=value}}",
beforeEach() {
this.siteSettings.support_mixed_text_direction = true;
@ -595,8 +595,21 @@ componentTest("clicking the toggle-direction button toggles the direction", {
const textarea = find("textarea.d-editor-input");
await click("button.toggle-direction");
assert.equal(textarea.attr("dir"), "rtl");
}
});
componentTest("clicking the toggle-direction changes dir from ltr to rtl", {
template: "{{d-editor value=value}}",
beforeEach() {
this.siteSettings.support_mixed_text_direction = true;
this.siteSettings.default_locale = "en_US";
},
async test(assert) {
const textarea = find("textarea.d-editor-input");
textarea.attr("dir", "ltr");
await click("button.toggle-direction");
assert.equal(textarea.attr("dir"), "ltr");
assert.equal(textarea.attr("dir"), "rtl");
}
});