discourse/plugins/chat/test/javascripts/unit/services/full-page-chat-test.js
Joffrey JAFFEUX 21570410ab
FIX: makes sidebar links respect drawer mode (#18918)
Clicking a link of the sidebar will now open the drawer and load the correct channel.

This solution should correctly solve these cases:

closing drawer, clicking sidebar channel, should open the drawer on correct channel
visiting /chat then visiting / and clicking sidebar channel, should open full page chat on correct channel
2022-11-08 16:23:13 +01:00

41 lines
1.1 KiB
JavaScript

import { module, test } from "qunit";
import { setupTest } from "ember-qunit";
module("Discourse Chat | Unit | Service | full-page-chat", function (hooks) {
setupTest(hooks);
hooks.beforeEach(function () {
this.fullPageChat = this.owner.lookup("service:full-page-chat");
});
hooks.afterEach(function () {
this.fullPageChat.exit();
});
test("defaults", function (assert) {
assert.strictEqual(this.fullPageChat.isActive, false);
});
test("enter", function (assert) {
this.fullPageChat.enter();
assert.strictEqual(this.fullPageChat.isActive, true);
});
test("exit", function (assert) {
this.fullPageChat.enter();
assert.strictEqual(this.fullPageChat.isActive, true);
this.fullPageChat.exit();
assert.strictEqual(this.fullPageChat.isActive, false);
});
test("previous route", function (assert) {
const name = "foo";
const params = { id: 1, slug: "bar" };
this.fullPageChat.enter({ name, params });
const routeInfo = this.fullPageChat.exit();
assert.strictEqual(routeInfo.name, name);
assert.deepEqual(routeInfo.params, params);
});
});