Commit ed33d4e5 authored by JC Brand's avatar JC Brand

Add spec for spoilers, clean up linting errors

parent be8b9edf
......@@ -17,7 +17,7 @@
var moment = converse.env.moment;
var u = converse.env.utils;
return describe("Chatboxes", function() {
return describe("Chatboxes", function () {
describe("A Chatbox", function () {
it("has a /help command to show the available commands",
......
(function (root, factory) {
define([
"jasmine",
"utils",
"mock",
"converse-core",
"test-utils"
], factory);
} (this, function (jasmine, utils, mock, converse, test_utils) {
var _ = converse.env._;
return describe("A spoiler message", function () {
it("can be sent without a hint",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.createContacts(_converse, 'current');
test_utils.openControlBox();
test_utils.openContactsPanel(_converse);
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
test_utils.openChatBoxFor(_converse, contact_jid);
var view = _converse.chatboxviews.get(contact_jid);
spyOn(view, 'onMessageSubmitted').and.callThrough();
var spoiler_toggle = view.el.querySelector('.toggle-spoiler-edit');
spoiler_toggle.click();
var textarea = view.el.querySelector('.chat-textarea');
textarea.value = 'This is the spoiler';
view.keyPressed({
target: textarea,
preventDefault: _.noop,
keyCode: 13
});
expect(view.onMessageSubmitted).toHaveBeenCalled();
done();
}));
it("can be sent with a hint",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.createContacts(_converse, 'current');
test_utils.openControlBox();
test_utils.openContactsPanel(_converse);
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
test_utils.openChatBoxFor(_converse, contact_jid);
var view = _converse.chatboxviews.get(contact_jid);
var spoiler_toggle = view.el.querySelector('.toggle-spoiler-edit');
spoiler_toggle.click();
var hint_input = view.el.querySelector('.chat-textarea-hint');
// TODO
done();
}));
});
}));
This diff is collapsed.
......@@ -32,6 +32,7 @@ require.config(config);
var specs = [
"jasmine",
//"spec/transcripts",
"spec/spoilers",
"spec/profiling",
"spec/utils",
"spec/converse",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment