mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Add tests from discourse-tagging.
This commit is contained in:
parent
9416c93a23
commit
a891125b92
1 changed files with 43 additions and 0 deletions
43
test/javascripts/acceptance/tag-hashtag-test.js.es6
Normal file
43
test/javascripts/acceptance/tag-hashtag-test.js.es6
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Tag Hashtag", {
|
||||
loggedIn: true,
|
||||
settings: { tagging_enabled: true },
|
||||
setup() {
|
||||
const response = (object) => {
|
||||
return [
|
||||
200,
|
||||
{"Content-Type": "application/json"},
|
||||
object
|
||||
];
|
||||
};
|
||||
|
||||
server.get('/tags/filter/search', () => { //eslint-disable-line
|
||||
return response({ results: [{ text: 'monkey', count: 1 }] });
|
||||
});
|
||||
|
||||
server.get('/category_hashtags/check', () => { //eslint-disable-line
|
||||
return response({ valid: [] });
|
||||
});
|
||||
|
||||
server.get('/tags/check', () => { //eslint-disable-line
|
||||
return response({ valid: [{ value: 'monkey', url: '/tags/monkey' }] });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("tag is cooked properly", () => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
click('#topic-footer-buttons .btn.create');
|
||||
|
||||
fillIn('.d-editor-input', "this is a tag hashtag #monkey::tag");
|
||||
andThen(() => {
|
||||
// TODO: Test that the autocomplete shows
|
||||
equal(find('.d-editor-preview:visible').html().trim(), "<p>this is a tag hashtag <a href=\"/tags/monkey\" class=\"hashtag\">#<span>monkey</span></a></p>");
|
||||
});
|
||||
|
||||
click('#reply-control .btn.create');
|
||||
andThen(() => {
|
||||
ok(find('.topic-post:last .cooked').html().trim().includes("<p>this is a tag hashtag <a href=\"/tags/monkey\" class=\"hashtag\">#<span>monkey</span></a></p>"));
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue