mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: blockquote button implementation
Previously clicking on blockquote in the middle of sentence would result in incorrect formatting
This commit is contained in:
parent
5897ae945a
commit
e2f57a154b
3 changed files with 21 additions and 12 deletions
|
@ -515,29 +515,37 @@ third line`
|
|||
|
||||
|
||||
testCase('quote button', function(assert, textarea) {
|
||||
click('button.quote');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello world.');
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
textarea.selectionStart = 6;
|
||||
textarea.selectionEnd = 11;
|
||||
textarea.selectionEnd = 9;
|
||||
});
|
||||
|
||||
click('button.quote');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello > world.');
|
||||
assert.equal(textarea.selectionStart, 6);
|
||||
assert.equal(textarea.selectionEnd, 13);
|
||||
assert.equal(this.get('value'), 'hello\n\n> wor\n\nld.');
|
||||
assert.equal(textarea.selectionStart, 7);
|
||||
assert.equal(textarea.selectionEnd, 12);
|
||||
});
|
||||
|
||||
click('button.quote');
|
||||
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello\n\nwor\n\nld.');
|
||||
assert.equal(textarea.selectionStart, 7);
|
||||
assert.equal(textarea.selectionEnd, 10);
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
textarea.selectionStart = 15;
|
||||
textarea.selectionEnd = 15;
|
||||
});
|
||||
|
||||
click('button.quote');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), 'hello world.');
|
||||
assert.equal(textarea.selectionStart, 6);
|
||||
assert.equal(textarea.selectionEnd, 11);
|
||||
assert.equal(this.get('value'), 'hello\n\nwor\n\nld.\n\n> Blockquote');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
testCase(`bullet button with no selection`, function(assert, textarea) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue