2015-04-06 14:14:00 -04:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2015-04-16 13:53:30 -04:00
|
|
|
acceptance("Topic", { loggedIn: true });
|
2013-06-20 15:02:02 -04:00
|
|
|
|
2016-11-11 14:13:19 -05:00
|
|
|
test("Share Popup", () => {
|
|
|
|
visit("/t/internationalization-localization/280");
|
|
|
|
andThen(() => {
|
|
|
|
ok(!exists('#share-link.visible'), 'it is not visible');
|
|
|
|
});
|
|
|
|
|
2017-05-03 22:30:16 -04:00
|
|
|
click("button[data-share-url]");
|
2016-11-11 14:13:19 -05:00
|
|
|
andThen(() => {
|
|
|
|
ok(exists('#share-link.visible'), 'it shows the popup');
|
|
|
|
});
|
|
|
|
|
|
|
|
click('#share-link .close-share');
|
|
|
|
andThen(() => {
|
|
|
|
ok(!exists('#share-link.visible'), 'it closes the popup');
|
|
|
|
});
|
2017-05-03 22:30:16 -04:00
|
|
|
|
2017-05-04 04:49:12 -04:00
|
|
|
// TODO tgxworld This fails on Travis but we need to push the security fix out
|
|
|
|
// first.
|
|
|
|
// click('#topic-footer-buttons .btn.create');
|
|
|
|
// fillIn('.d-editor-input', '<h2><div data-share-url="something">Click</button><h2>');
|
|
|
|
//
|
|
|
|
// click('#reply-control .btn.create');
|
|
|
|
// click('h2 div[data-share-url]');
|
|
|
|
//
|
|
|
|
// andThen(() => {
|
|
|
|
// ok(!exists('#share-link.visible'), 'it does not show the popup');
|
|
|
|
// });
|
2016-11-11 14:13:19 -05:00
|
|
|
});
|
|
|
|
|
2015-04-16 13:53:30 -04:00
|
|
|
test("Showing and hiding the edit controls", () => {
|
|
|
|
visit("/t/internationalization-localization/280");
|
|
|
|
|
|
|
|
click('#topic-title .fa-pencil');
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
ok(exists('#edit-title'), 'it shows the editing controls');
|
|
|
|
});
|
|
|
|
|
|
|
|
fillIn('#edit-title', 'this is the new title');
|
|
|
|
click('#topic-title .cancel-edit');
|
2015-03-19 07:22:56 -04:00
|
|
|
andThen(() => {
|
2015-04-16 13:53:30 -04:00
|
|
|
ok(!exists('#edit-title'), 'it hides the editing controls');
|
2013-06-20 15:02:02 -04:00
|
|
|
});
|
|
|
|
});
|
2014-09-17 11:18:41 -04:00
|
|
|
|
2015-04-16 13:53:30 -04:00
|
|
|
test("Updating the topic title and category", () => {
|
|
|
|
visit("/t/internationalization-localization/280");
|
|
|
|
click('#topic-title .fa-pencil');
|
|
|
|
|
|
|
|
fillIn('#edit-title', 'this is the new title');
|
|
|
|
selectDropdown('.category-combobox', 4);
|
|
|
|
|
|
|
|
click('#topic-title .submit-edit');
|
|
|
|
|
2015-03-19 07:22:56 -04:00
|
|
|
andThen(() => {
|
2015-04-16 13:53:30 -04:00
|
|
|
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');
|
2014-09-17 11:18:41 -04:00
|
|
|
});
|
|
|
|
});
|
2017-01-25 01:33:16 -05:00
|
|
|
|
|
|
|
test("Marking a topic as wiki", () => {
|
|
|
|
server.put('/posts/398/wiki', () => { // eslint-disable-line no-undef
|
|
|
|
return [
|
|
|
|
200,
|
|
|
|
{ "Content-Type": "application/json" },
|
|
|
|
{}
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
visit("/t/internationalization-localization/280");
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
ok(find('a.wiki').length === 0, 'it does not show the wiki icon');
|
|
|
|
});
|
|
|
|
|
|
|
|
click('.topic-post:eq(0) button.show-more-actions');
|
|
|
|
click('.topic-post:eq(0) button.show-post-admin-menu');
|
|
|
|
click('.btn.wiki');
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
ok(find('a.wiki').length === 1, 'it shows the wiki icon');
|
|
|
|
});
|
|
|
|
});
|
2016-11-29 12:59:42 -05:00
|
|
|
|
|
|
|
test("Reply as new topic", () => {
|
|
|
|
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');
|
|
|
|
|
|
|
|
equal(
|
|
|
|
find('.d-editor-input').val().trim(),
|
2017-02-02 23:09:30 -05:00
|
|
|
`Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`,
|
2016-11-29 12:59:42 -05:00
|
|
|
"it fills composer with the ring string"
|
|
|
|
);
|
|
|
|
equal(
|
2017-02-02 23:09:30 -05:00
|
|
|
find('.category-combobox').select2('data').text, "feature",
|
2016-11-29 12:59:42 -05:00
|
|
|
"it fills category selector with the right category"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test("Reply as new message", () => {
|
|
|
|
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');
|
|
|
|
|
|
|
|
equal(
|
|
|
|
find('.d-editor-input').val().trim(),
|
2017-02-02 23:09:30 -05:00
|
|
|
`Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`,
|
2016-11-29 12:59:42 -05:00
|
|
|
"it fills composer with the ring string"
|
|
|
|
);
|
|
|
|
|
|
|
|
const targets = find('.item span', '.composer-fields');
|
|
|
|
|
|
|
|
equal(
|
|
|
|
$(targets[0]).text(), "someguy",
|
|
|
|
"it fills up the composer with the right user to start the PM to"
|
|
|
|
);
|
|
|
|
|
|
|
|
equal(
|
|
|
|
$(targets[1]).text(), "test",
|
|
|
|
"it fills up the composer with the right user to start the PM to"
|
|
|
|
);
|
|
|
|
|
|
|
|
equal(
|
|
|
|
$(targets[2]).text(), "Group",
|
|
|
|
"it fills up the composer with the right group to start the PM to"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|