mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 15:14:16 +08:00
UX: Use separate input fields for link and description in d-editor
This commit is contained in:
@ -208,24 +208,25 @@ testCase('link modal (cancel)', function(assert) {
|
||||
|
||||
testCase('link modal (simple link)', function(assert, textarea) {
|
||||
click('button.link');
|
||||
fillIn('.insert-link input', 'http://eviltrout.com');
|
||||
|
||||
const url = 'http://eviltrout.com';
|
||||
|
||||
fillIn('.insert-link input.link-url', url);
|
||||
click('.insert-link button.btn-primary');
|
||||
const desc = I18n.t('composer.link_description');
|
||||
andThen(() => {
|
||||
assert.equal(this.$('.insert-link.hidden').length, 1);
|
||||
assert.equal(this.get('value'), `hello world.[${desc}](http://eviltrout.com)`);
|
||||
assert.equal(this.get('value'), `hello world.[${url}](${url})`);
|
||||
assert.equal(textarea.selectionStart, 13);
|
||||
assert.equal(textarea.selectionEnd, 13 + desc.length);
|
||||
assert.equal(textarea.selectionEnd, 13 + url.length);
|
||||
});
|
||||
});
|
||||
|
||||
testCase('link modal auto http addition', function(assert) {
|
||||
click('button.link');
|
||||
fillIn('.insert-link input', 'sam.com');
|
||||
fillIn('.insert-link input.link-url', 'sam.com');
|
||||
click('.insert-link button.btn-primary');
|
||||
const desc = I18n.t('composer.link_description');
|
||||
andThen(() => {
|
||||
assert.equal(this.get('value'), `hello world.[${desc}](http://sam.com)`);
|
||||
assert.equal(this.get('value'), `hello world.[sam.com](http://sam.com)`);
|
||||
});
|
||||
});
|
||||
|
||||
@ -234,7 +235,7 @@ testCase('link modal (simple link) with selected text', function(assert, textare
|
||||
textarea.selectionEnd = 12;
|
||||
|
||||
click('button.link');
|
||||
fillIn('.insert-link input', 'http://eviltrout.com');
|
||||
fillIn('.insert-link input.link-url', 'http://eviltrout.com');
|
||||
click('.insert-link button.btn-primary');
|
||||
andThen(() => {
|
||||
assert.equal(this.$('.insert-link.hidden').length, 1);
|
||||
@ -244,7 +245,8 @@ testCase('link modal (simple link) with selected text', function(assert, textare
|
||||
|
||||
testCase('link modal (link with description)', function(assert) {
|
||||
click('button.link');
|
||||
fillIn('.insert-link input', 'http://eviltrout.com "evil trout"');
|
||||
fillIn('.insert-link input.link-url', 'http://eviltrout.com');
|
||||
fillIn('.insert-link input.link-text', 'evil trout');
|
||||
click('.insert-link button.btn-primary');
|
||||
andThen(() => {
|
||||
assert.equal(this.$('.insert-link.hidden').length, 1);
|
||||
|
Reference in New Issue
Block a user