mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 08:41:56 +08:00
Upgrade QUnit to latest version
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Topic", { loggedIn: true });
|
||||
|
||||
test("Share Popup", () => {
|
||||
QUnit.test("Share Popup", assert => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
andThen(() => {
|
||||
ok(!exists('#share-link.visible'), 'it is not visible');
|
||||
assert.ok(!exists('#share-link.visible'), 'it is not visible');
|
||||
});
|
||||
|
||||
click("button[data-share-url]");
|
||||
andThen(() => {
|
||||
ok(exists('#share-link.visible'), 'it shows the popup');
|
||||
assert.ok(exists('#share-link.visible'), 'it shows the popup');
|
||||
});
|
||||
|
||||
click('#share-link .close-share');
|
||||
andThen(() => {
|
||||
ok(!exists('#share-link.visible'), 'it closes the popup');
|
||||
assert.ok(!exists('#share-link.visible'), 'it closes the popup');
|
||||
});
|
||||
|
||||
// TODO tgxworld This fails on Travis but we need to push the security fix out
|
||||
@ -30,23 +30,23 @@ test("Share Popup", () => {
|
||||
// });
|
||||
});
|
||||
|
||||
test("Showing and hiding the edit controls", () => {
|
||||
QUnit.test("Showing and hiding the edit controls", assert => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
|
||||
click('#topic-title .fa-pencil');
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('#edit-title'), 'it shows the editing controls');
|
||||
assert.ok(exists('#edit-title'), 'it shows the editing controls');
|
||||
});
|
||||
|
||||
fillIn('#edit-title', 'this is the new title');
|
||||
click('#topic-title .cancel-edit');
|
||||
andThen(() => {
|
||||
ok(!exists('#edit-title'), 'it hides the editing controls');
|
||||
assert.ok(!exists('#edit-title'), 'it hides the editing controls');
|
||||
});
|
||||
});
|
||||
|
||||
test("Updating the topic title and category", () => {
|
||||
QUnit.test("Updating the topic title and category", assert => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
click('#topic-title .fa-pencil');
|
||||
|
||||
@ -56,12 +56,12 @@ test("Updating the topic title and category", () => {
|
||||
click('#topic-title .submit-edit');
|
||||
|
||||
andThen(() => {
|
||||
equal(find('#topic-title .badge-category').text(), 'faq', 'it displays the new category');
|
||||
equal(find('.fancy-title').text().trim(), 'this is the new title', 'it displays the new title');
|
||||
assert.equal(find('#topic-title .badge-category').text(), 'faq', 'it displays the new category');
|
||||
assert.equal(find('.fancy-title').text().trim(), 'this is the new title', 'it displays the new title');
|
||||
});
|
||||
});
|
||||
|
||||
test("Marking a topic as wiki", () => {
|
||||
QUnit.test("Marking a topic as wiki", assert => {
|
||||
server.put('/posts/398/wiki', () => { // eslint-disable-line no-undef
|
||||
return [
|
||||
200,
|
||||
@ -73,7 +73,7 @@ test("Marking a topic as wiki", () => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
|
||||
andThen(() => {
|
||||
ok(find('a.wiki').length === 0, 'it does not show the wiki icon');
|
||||
assert.ok(find('a.wiki').length === 0, 'it does not show the wiki icon');
|
||||
});
|
||||
|
||||
click('.topic-post:eq(0) button.show-more-actions');
|
||||
@ -81,39 +81,39 @@ test("Marking a topic as wiki", () => {
|
||||
click('.btn.wiki');
|
||||
|
||||
andThen(() => {
|
||||
ok(find('a.wiki').length === 1, 'it shows the wiki icon');
|
||||
assert.ok(find('a.wiki').length === 1, 'it shows the wiki icon');
|
||||
});
|
||||
});
|
||||
|
||||
test("Reply as new topic", () => {
|
||||
QUnit.test("Reply as new topic", assert => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
click("button.share:eq(0)");
|
||||
click(".reply-as-new-topic a");
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('.d-editor-input'), 'the composer input is visible');
|
||||
assert.ok(exists('.d-editor-input'), 'the composer input is visible');
|
||||
|
||||
equal(
|
||||
assert.equal(
|
||||
find('.d-editor-input').val().trim(),
|
||||
`Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`,
|
||||
"it fills composer with the ring string"
|
||||
);
|
||||
equal(
|
||||
assert.equal(
|
||||
find('.category-combobox').select2('data').text, "feature",
|
||||
"it fills category selector with the right category"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("Reply as new message", () => {
|
||||
QUnit.test("Reply as new message", assert => {
|
||||
visit("/t/pm-for-testing/12");
|
||||
click("button.share:eq(0)");
|
||||
click(".reply-as-new-topic a");
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('.d-editor-input'), 'the composer input is visible');
|
||||
assert.ok(exists('.d-editor-input'), 'the composer input is visible');
|
||||
|
||||
equal(
|
||||
assert.equal(
|
||||
find('.d-editor-input').val().trim(),
|
||||
`Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`,
|
||||
"it fills composer with the ring string"
|
||||
@ -121,24 +121,24 @@ test("Reply as new message", () => {
|
||||
|
||||
const targets = find('.item span', '.composer-fields');
|
||||
|
||||
equal(
|
||||
assert.equal(
|
||||
$(targets[0]).text(), "someguy",
|
||||
"it fills up the composer with the right user to start the PM to"
|
||||
);
|
||||
|
||||
equal(
|
||||
assert.equal(
|
||||
$(targets[1]).text(), "test",
|
||||
"it fills up the composer with the right user to start the PM to"
|
||||
);
|
||||
|
||||
equal(
|
||||
assert.equal(
|
||||
$(targets[2]).text(), "Group",
|
||||
"it fills up the composer with the right group to start the PM to"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("Updating the topic title with emojis", () => {
|
||||
QUnit.test("Updating the topic title with emojis", assert => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
click('#topic-title .fa-pencil');
|
||||
|
||||
@ -147,6 +147,6 @@ test("Updating the topic title with emojis", () => {
|
||||
click('#topic-title .submit-edit');
|
||||
|
||||
andThen(() => {
|
||||
equal(find('.fancy-title').html().trim(), 'emojis title <img src=\"/images/emoji/emoji_one/bike.png?v=5\" title=\"bike\" alt=\"bike\" class=\"emoji\"> <img src=\"/images/emoji/emoji_one/blonde_woman/6.png?v=5\" title=\"blonde_woman:t6\" alt=\"blonde_woman:t6\" class=\"emoji\">', 'it displays the new title with emojis');
|
||||
assert.equal(find('.fancy-title').html().trim(), 'emojis title <img src=\"/images/emoji/emoji_one/bike.png?v=5\" title=\"bike\" alt=\"bike\" class=\"emoji\"> <img src=\"/images/emoji/emoji_one/blonde_woman/6.png?v=5\" title=\"blonde_woman:t6\" alt=\"blonde_woman:t6\" class=\"emoji\">', 'it displays the new title with emojis');
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user