mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 05:03:43 +08:00
0a5f548635
As part of this move, we are also renaming `discourse-chat` to `chat`.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import { module, test } from "qunit";
|
|
import { getOwner } from "discourse-common/lib/get-owner";
|
|
|
|
module("Discourse Chat | Unit | Service | full-page-chat", function (hooks) {
|
|
hooks.beforeEach(function () {
|
|
this.fullPageChat = getOwner(this).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("isPreferred", function (assert) {
|
|
assert.strictEqual(this.fullPageChat.isPreferred, false);
|
|
this.fullPageChat.isPreferred = true;
|
|
assert.strictEqual(this.fullPageChat.isPreferred, true);
|
|
});
|
|
|
|
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);
|
|
});
|
|
});
|