From c0feea4629324a689ce0e6d8c189b1b423d5ffc9 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 4 Feb 2016 15:38:50 +0800 Subject: [PATCH] Add tests for category hashtag. --- .../acceptance/category-hashtag-test.js.es6 | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/javascripts/acceptance/category-hashtag-test.js.es6 diff --git a/test/javascripts/acceptance/category-hashtag-test.js.es6 b/test/javascripts/acceptance/category-hashtag-test.js.es6 new file mode 100644 index 00000000000..a15cd9faf52 --- /dev/null +++ b/test/javascripts/acceptance/category-hashtag-test.js.es6 @@ -0,0 +1,34 @@ +import { acceptance } from "helpers/qunit-helpers"; + +acceptance("Category hashtag", { + loggedIn: true, + setup() { + const response = (object) => { + return [ + 200, + {"Content-Type": "application/json"}, + object + ]; + }; + + server.get('/category_hashtags/check', () => { //eslint-disable-line + return response({ valid: [{ slug: "bug", url: '/c/bugs' }] }); + }); + } +}); + +test("category hashtag is cooked properly", () => { + visit("/t/internationalization-localization/280"); + click('#topic-footer-buttons .btn.create'); + + fillIn('.d-editor-input', "this is a category hashtag #bug"); + andThen(() => { + // TODO: Test that the autocomplete shows + equal(find('.d-editor-preview:visible').html().trim(), "

this is a category hashtag #bug

"); + }); + + click('#reply-control .btn.create'); + andThen(() => { + equal(find('.topic-post:last .cooked p').html().trim(), "this is a category hashtag #bug"); + }); +});