Skip to content

Commit

Permalink
Verify V11
Browse files Browse the repository at this point in the history
  • Loading branch information
FaeyUmbrea committed Jun 15, 2023
1 parent cd39cd7 commit 99aa424
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"manifestPlusVersion": "1.2.0",
"compatibility": {
"minimum": 10,
"verified": 10,
"verified": 11,
"maximum": 11
},
"authors": [
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function start() {
if (game.view === "game") {
const ui = await import("./utils/ui.js");
await ui.registerUI();
await ui.showNotifications();

// Show notifications panel if UI is loaded
Hooks.once("ready", () => ui.showNotifications());
}

// Load OBS Stuff only in OBS
Expand Down
5 changes: 5 additions & 0 deletions src/svelte/NotificationCenterUI.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
import { ApplicationShell } from "@typhonjs-fvtt/runtime/svelte/component/core";
import notifications from "../utils/notifications.json";
import CollapsibleSection from "./components/CollapsibleSection.svelte";
import { setSetting } from "../utils/settings.js";
import { onDestroy } from "svelte";
export let elementRoot = void 0;
function openLink(uri) {
window.open(uri, "_blank").focus();
}
onDestroy(() => {
setSetting("lastReadNotification", notifications[0].id);
});
</script>

<ApplicationShell bind:elementRoot="{elementRoot}">
Expand Down
1 change: 1 addition & 0 deletions src/utils/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export async function registerUI() {
}

export function showNotifications() {
if (!game.user.isGM) return;
const lastRead = getSetting("lastReadNotification");
if (lastRead < notifications[0].id) {
new NotificationCenter().render(true);
Expand Down
13 changes: 13 additions & 0 deletions tests/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ test.describe("DM Client Only Tests", () => {

await gmPage.waitForFunction(() => window["game"].ready);
});
test("Close Notification Center", async () => {
await closeNoficationCenter(gmPage);
});
test("Click Director Button to Open and Close", async () => {
await openDirector(gmPage);

Expand Down Expand Up @@ -561,6 +564,16 @@ async function endCombat(gmPage) {
.waitFor({ state: "hidden" });
}

async function closeNoficationCenter(gmPage) {
await expect(
gmPage.locator("div[id=notification-application]")
).toBeVisible();
await gmPage.locator("div[id=notification-application] a.close").click();
await expect(
gmPage.locator("div[id=notification-application]")
).not.toBeVisible();
}

async function openDirector(gmPage) {
await gmPage.locator("li[data-tool=openStreamDirector]").click();
await expect(gmPage.locator("div[id=director-application]")).toBeVisible();
Expand Down

0 comments on commit 99aa424

Please # to comment.