mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 02:51:14 +08:00
fix 'details' button acceptance test
This commit is contained in:
@ -16,7 +16,7 @@ test('details button', (assert) => {
|
|||||||
andThen(() => {
|
andThen(() => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".d-editor-input").val(),
|
find(".d-editor-input").val(),
|
||||||
`\n[details=${I18n.t("composer.details_title")}]\n${I18n.t("composer.details_text")}\n[/details]\n`,
|
`\n[details="${I18n.t("composer.details_title")}"]\n${I18n.t("composer.details_text")}\n[/details]\n`,
|
||||||
'it should contain the right output'
|
'it should contain the right output'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -35,13 +35,13 @@ test('details button', (assert) => {
|
|||||||
andThen(() => {
|
andThen(() => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".d-editor-input").val(),
|
find(".d-editor-input").val(),
|
||||||
`\n[details=${I18n.t("composer.details_title")}]\nThis is my title\n[/details]\n`,
|
`\n[details="${I18n.t("composer.details_title")}"]\nThis is my title\n[/details]\n`,
|
||||||
'it should contain the right selected output'
|
'it should contain the right selected output'
|
||||||
);
|
);
|
||||||
|
|
||||||
const textarea = findTextarea();
|
const textarea = findTextarea();
|
||||||
assert.equal(textarea.selectionStart, 19, 'it should start highlighting at the right position');
|
assert.equal(textarea.selectionStart, 21, 'it should start highlighting at the right position');
|
||||||
assert.equal(textarea.selectionEnd, 35, 'it should end highlighting at the right position');
|
assert.equal(textarea.selectionEnd, 37, 'it should end highlighting at the right position');
|
||||||
});
|
});
|
||||||
|
|
||||||
fillIn('.d-editor-input', "Before some text in between After");
|
fillIn('.d-editor-input', "Before some text in between After");
|
||||||
@ -58,13 +58,13 @@ test('details button', (assert) => {
|
|||||||
andThen(() => {
|
andThen(() => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".d-editor-input").val(),
|
find(".d-editor-input").val(),
|
||||||
`Before \n[details=${I18n.t("composer.details_title")}]\nsome text in between\n[/details]\n After`,
|
`Before \n[details="${I18n.t("composer.details_title")}"]\nsome text in between\n[/details]\n After`,
|
||||||
'it should contain the right output'
|
'it should contain the right output'
|
||||||
);
|
);
|
||||||
|
|
||||||
const textarea = findTextarea();
|
const textarea = findTextarea();
|
||||||
assert.equal(textarea.selectionStart, 26, 'it should start highlighting at the right position');
|
assert.equal(textarea.selectionStart, 28, 'it should start highlighting at the right position');
|
||||||
assert.equal(textarea.selectionEnd, 46, 'it should end highlighting at the right position');
|
assert.equal(textarea.selectionEnd, 48, 'it should end highlighting at the right position');
|
||||||
});
|
});
|
||||||
|
|
||||||
fillIn('.d-editor-input', "Before \nsome text in between\n After");
|
fillIn('.d-editor-input', "Before \nsome text in between\n After");
|
||||||
@ -81,12 +81,12 @@ test('details button', (assert) => {
|
|||||||
andThen(() => {
|
andThen(() => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".d-editor-input").val(),
|
find(".d-editor-input").val(),
|
||||||
`Before \n\n[details=${I18n.t("composer.details_title")}]\nsome text in between\n[/details]\n\n After`,
|
`Before \n\n[details="${I18n.t("composer.details_title")}"]\nsome text in between\n[/details]\n\n After`,
|
||||||
'it should contain the right output'
|
'it should contain the right output'
|
||||||
);
|
);
|
||||||
|
|
||||||
const textarea = findTextarea();
|
const textarea = findTextarea();
|
||||||
assert.equal(textarea.selectionStart, 27, 'it should start highlighting at the right position');
|
assert.equal(textarea.selectionStart, 29, 'it should start highlighting at the right position');
|
||||||
assert.equal(textarea.selectionEnd, 47, 'it should end highlighting at the right position');
|
assert.equal(textarea.selectionEnd, 49, 'it should end highlighting at the right position');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user