|
10 | 10 | // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ |
11 | 11 | // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ |
12 | 12 |
|
13 | | -import { test, expect } from "@finos/perspective-test"; |
| 13 | +import { test, expect, shadow_type } from "@finos/perspective-test"; |
14 | 14 | import { |
15 | 15 | compareContentsToSnapshot, |
16 | 16 | API_VERSION, |
@@ -93,6 +93,45 @@ test.describe("Events", () => { |
93 | 93 | ]); |
94 | 94 | }); |
95 | 95 |
|
| 96 | + test("Editing the title fires the 'perspective-config-update' event", async ({ |
| 97 | + page, |
| 98 | + }) => { |
| 99 | + await page.evaluate(async () => { |
| 100 | + const viewer = document.querySelector("perspective-viewer"); |
| 101 | + window["acc"] = []; |
| 102 | + |
| 103 | + await viewer!.restore({ |
| 104 | + settings: true, |
| 105 | + }); |
| 106 | + |
| 107 | + viewer!.addEventListener("perspective-config-update", (event) => { |
| 108 | + window["acc"].push(event.detail); |
| 109 | + }); |
| 110 | + }); |
| 111 | + |
| 112 | + await shadow_type( |
| 113 | + page, |
| 114 | + "New Title", |
| 115 | + true, |
| 116 | + "perspective-viewer", |
| 117 | + "#status_bar", |
| 118 | + "input" |
| 119 | + ); |
| 120 | + |
| 121 | + const result = await page.evaluate(async () => { |
| 122 | + return window["acc"]; |
| 123 | + }); |
| 124 | + |
| 125 | + expect(result.map((x) => x.title)).toEqual(["New Title"]); |
| 126 | + |
| 127 | + const config = await page.evaluate(async () => { |
| 128 | + const viewer = document.querySelector("perspective-viewer"); |
| 129 | + return await viewer?.save(); |
| 130 | + }); |
| 131 | + |
| 132 | + expect(config.title).toEqual("New Title"); |
| 133 | + }); |
| 134 | + |
96 | 135 | // NOTE: Previously skipped, kept for future reference |
97 | 136 | // test.skip("restore with a 'plugin' field fires the 'perspective-plugin-update' event", async ({ |
98 | 137 | // page, |
|
0 commit comments