mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Refactor code; add tests
This commit is contained in:
@ -715,6 +715,26 @@ testCase(`list button with line sequence`, function(assert, textarea) {
|
||||
});
|
||||
});
|
||||
|
||||
componentTest('clicking the toggle-direction button toggles the direction', {
|
||||
template: '{{d-editor value=value}}',
|
||||
beforeEach() {
|
||||
this.siteSettings.support_mixed_text_direction = true;
|
||||
this.siteSettings.default_locale = "en";
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
const textarea = this.$('textarea.d-editor-input');
|
||||
click('button.toggle-direction');
|
||||
andThen(() => {
|
||||
assert.equal(textarea.attr('dir'), 'rtl');
|
||||
});
|
||||
click('button.toggle-direction');
|
||||
andThen(() => {
|
||||
assert.equal(textarea.attr('dir'), 'ltr');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
testCase(`doesn't jump to bottom with long text`, function(assert, textarea) {
|
||||
|
||||
let longText = 'hello world.';
|
||||
|
@ -22,3 +22,27 @@ componentTest("support a placeholder", {
|
||||
assert.equal(this.$('input').prop('placeholder'), 'placeholder.i18n.key');
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("sets the dir attribute to ltr for Hebrew text", {
|
||||
template: `{{text-field value='זהו שם עברי עם מקום עברי'}}`,
|
||||
beforeEach() {
|
||||
this.siteSettings.support_mixed_text_direction = true;
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$('input').attr('dir'), 'rtl');
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("sets the dir attribute to ltr for English text", {
|
||||
template: `{{text-field value='This is a ltr title'}}`,
|
||||
beforeEach() {
|
||||
this.siteSettings.support_mixed_text_direction = true;
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(this.$('input').attr('dir'), 'ltr');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user