mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 22:53:44 +08:00
84c1cc70d6
- better handling of drawer state using chat state manager - removes various float and topic occurrences to use drawer - ensures user can chat before doing a lot of chat setup - fixes a bug which was creating presence errors in tests - removes dead code
79 lines
1.6 KiB
JavaScript
79 lines
1.6 KiB
JavaScript
import componentTest, {
|
|
setupRenderingTest,
|
|
} from "discourse/tests/helpers/component-test";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
|
import {
|
|
setup as setupChatStub,
|
|
teardown as teardownChatStub,
|
|
} from "../helpers/chat-stub";
|
|
import { module } from "qunit";
|
|
|
|
module("Discourse Chat | Component | sidebar-channels", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
componentTest("default", {
|
|
template: hbs`{{sidebar-channels}}`,
|
|
|
|
beforeEach() {
|
|
setupChatStub(this);
|
|
},
|
|
|
|
afterEach() {
|
|
teardownChatStub();
|
|
},
|
|
|
|
async test(assert) {
|
|
assert.ok(exists("[data-chat-channel-id]"));
|
|
},
|
|
});
|
|
|
|
componentTest("chat is on chat page", {
|
|
template: hbs`{{sidebar-channels}}`,
|
|
|
|
beforeEach() {
|
|
setupChatStub(this, {});
|
|
},
|
|
|
|
afterEach() {
|
|
teardownChatStub();
|
|
},
|
|
|
|
async test(assert) {
|
|
assert.ok(exists("[data-chat-channel-id]"));
|
|
},
|
|
});
|
|
|
|
componentTest("none of the conditions are fulfilled", {
|
|
template: hbs`{{sidebar-channels}}`,
|
|
|
|
beforeEach() {
|
|
setupChatStub(this, { userCanChat: false });
|
|
},
|
|
|
|
afterEach() {
|
|
teardownChatStub();
|
|
},
|
|
|
|
async test(assert) {
|
|
assert.notOk(exists("[data-chat-channel-id]"));
|
|
},
|
|
});
|
|
|
|
componentTest("user cant chat", {
|
|
template: hbs`{{sidebar-channels}}`,
|
|
|
|
beforeEach() {
|
|
setupChatStub(this, { userCanChat: false });
|
|
},
|
|
|
|
afterEach() {
|
|
teardownChatStub();
|
|
},
|
|
|
|
async test(assert) {
|
|
assert.notOk(exists("[data-chat-channel-id]"));
|
|
},
|
|
});
|
|
});
|