Upgrade QUnit to latest version

This commit is contained in:
Robin Ward
2017-06-14 13:57:58 -04:00
parent 8ae445766f
commit cc525b1a8d
145 changed files with 7569 additions and 6763 deletions

View File

@ -6,7 +6,7 @@ function findTextarea() {
return find(".d-editor-input")[0];
}
test('details button', () => {
test('details button', (assert) => {
visit("/");
click('#create-topic');
@ -14,7 +14,7 @@ test('details button', () => {
click('.popup-menu .fa-caret-right');
andThen(() => {
equal(
assert.equal(
find(".d-editor-input").val(),
`[details=${I18n.t("composer.details_title")}]${I18n.t("composer.details_text")}[/details]`,
'it should contain the right output'
@ -33,15 +33,15 @@ test('details button', () => {
click('.popup-menu .fa-caret-right');
andThen(() => {
equal(
assert.equal(
find(".d-editor-input").val(),
`[details=${I18n.t("composer.details_title")}]This is my title[/details]`,
'it should contain the right selected output'
);
const textarea = findTextarea();
equal(textarea.selectionStart, 17, 'it should start highlighting at the right position');
equal(textarea.selectionEnd, 33, 'it should end highlighting at the right position');
assert.equal(textarea.selectionStart, 17, 'it should start highlighting at the right position');
assert.equal(textarea.selectionEnd, 33, 'it should end highlighting at the right position');
});
fillIn('.d-editor-input', "Before some text in between After");
@ -56,15 +56,15 @@ test('details button', () => {
click('.popup-menu .fa-caret-right');
andThen(() => {
equal(
assert.equal(
find(".d-editor-input").val(),
`Before [details=${I18n.t("composer.details_title")}]some text in between[/details] After`,
'it should contain the right output'
);
const textarea = findTextarea();
equal(textarea.selectionStart, 24, 'it should start highlighting at the right position');
equal(textarea.selectionEnd, 44, 'it should end highlighting at the right position');
assert.equal(textarea.selectionStart, 24, 'it should start highlighting at the right position');
assert.equal(textarea.selectionEnd, 44, 'it should end highlighting at the right position');
});
fillIn('.d-editor-input', "Before\nsome text in between\nAfter");
@ -79,14 +79,14 @@ test('details button', () => {
click('.popup-menu .fa-caret-right');
andThen(() => {
equal(
assert.equal(
find(".d-editor-input").val(),
`Before\n[details=${I18n.t("composer.details_title")}]some text in between[/details]\nAfter`,
'it should contain the right output'
);
const textarea = findTextarea();
equal(textarea.selectionStart, 24, 'it should start highlighting at the right position');
equal(textarea.selectionEnd, 44, 'it should end highlighting at the right position');
assert.equal(textarea.selectionStart, 24, 'it should start highlighting at the right position');
assert.equal(textarea.selectionEnd, 44, 'it should end highlighting at the right position');
});
});

View File

@ -13,11 +13,11 @@ const defaultOpts = buildOptions({
getURL: url => url
});
function cooked(input, expected, text) {
equal(new PrettyText(defaultOpts).cook(input), expected.replace(/\/>/g, ">"), text);
};
test("details", () => {
test("details", assert => {
const cooked = (input, expected, text) => {
assert.equal(new PrettyText(defaultOpts).cook(input), expected.replace(/\/>/g, ">"), text);
};
cooked(`<details><summary>Info</summary>coucou</details>`,
`<details><summary>Info</summary>\n\n<p>coucou</p>\n\n</details>`,
"manual HTML for details");