2015-04-07 02:14:00 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2015-04-17 01:53:30 +08:00
|
|
|
acceptance("Topic", { loggedIn: true });
|
2013-06-21 03:02:02 +08:00
|
|
|
|
2016-11-12 03:13:19 +08:00
|
|
|
test("Share Popup", () => {
|
|
|
|
visit("/t/internationalization-localization/280");
|
|
|
|
andThen(() => {
|
|
|
|
ok(!exists('#share-link.visible'), 'it is not visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
click("[data-share-url]:eq(0)");
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-04-17 01:53:30 +08: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 19:22:56 +08:00
|
|
|
andThen(() => {
|
2015-04-17 01:53:30 +08:00
|
|
|
ok(!exists('#edit-title'), 'it hides the editing controls');
|
2013-06-21 03:02:02 +08:00
|
|
|
});
|
|
|
|
});
|
2014-09-17 23:18:41 +08:00
|
|
|
|
2015-04-17 01:53:30 +08: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 19:22:56 +08:00
|
|
|
andThen(() => {
|
2015-04-17 01:53:30 +08: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 23:18:41 +08:00
|
|
|
});
|
|
|
|
});
|