@player-ui/data-change-listener-plugin 0.11.1 → 0.11.2--canary.649.23032

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -6,10 +6,10 @@
6
6
  "types"
7
7
  ],
8
8
  "name": "@player-ui/data-change-listener-plugin",
9
- "version": "0.11.1",
9
+ "version": "0.11.2--canary.649.23032",
10
10
  "main": "dist/cjs/index.cjs",
11
11
  "peerDependencies": {
12
- "@player-ui/player": "0.11.1"
12
+ "@player-ui/player": "0.11.2--canary.649.23032"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@player-ui/partial-match-registry": "workspace:*",
@@ -37,8 +37,8 @@ const dataChangeFlow: Flow = {
37
37
  id: "test-flow",
38
38
  data: {
39
39
  name: {
40
- first: "Adam",
41
- last: "Dierkens",
40
+ first: "john",
41
+ last: "smith",
42
42
  },
43
43
  },
44
44
  views: [
@@ -148,7 +148,7 @@ describe("Data-Change-Listener", () => {
148
148
  });
149
149
 
150
150
  it("should not call evaluate if field does not change", () => {
151
- dataController.set([["name.first", "Adam"]]);
151
+ dataController.set([["name.first", "john"]]);
152
152
  expect(testExpression).not.toHaveBeenCalled();
153
153
  });
154
154
 
@@ -171,13 +171,20 @@ describe("Data-Change-Listener", () => {
171
171
  const state = player.getState() as InProgressState;
172
172
  state.controllers.flow.transition("next");
173
173
 
174
+ await vitest.waitFor(() => {
175
+ expect(state.controllers.flow.current?.currentState?.name).toBe("VIEW_2");
176
+ });
177
+
174
178
  await vitest.waitFor(() => expect(testExpression).not.toHaveBeenCalled());
175
- dataController.set([["name.last", "Dierkens"]], {
179
+ dataController.set([["name.last", "smith"]], {
176
180
  context: {
177
181
  model: dataController.getModel(),
178
182
  },
179
183
  });
180
- expect(testExpression).toHaveBeenCalledWith("hello Dierkens");
184
+
185
+ await vitest.waitFor(() => {
186
+ expect(testExpression).toHaveBeenCalledWith("hello smith");
187
+ });
181
188
  });
182
189
 
183
190
  it("should call the listener for each item when a sub-item changes", () => {
@@ -217,8 +224,8 @@ describe("Data-Change-Listener with Validations", () => {
217
224
  id: "test-flow",
218
225
  data: {
219
226
  name: {
220
- first: "Madam",
221
- last: "Dierkens",
227
+ first: "Mjohn",
228
+ last: "smith",
222
229
  },
223
230
  },
224
231
  views: [
@@ -242,8 +249,8 @@ describe("Data-Change-Listener with Validations", () => {
242
249
  {
243
250
  ref: "name.first",
244
251
  type: "expression",
245
- exp: '{{name.first}} == "Adam"',
246
- message: "Adam is always the right option",
252
+ exp: '{{name.first}} == "john"',
253
+ message: "john is always the right option",
247
254
  trigger: "change",
248
255
  },
249
256
  ],
@@ -324,7 +331,7 @@ describe("Data-Change-Listener with Validations", () => {
324
331
  it("bindings with a value that failed validation do not trigger listeners", async () => {
325
332
  expect(getInputAsset().validation).toBe(undefined);
326
333
 
327
- getInputAsset().set("AdamAdam");
334
+ getInputAsset().set("johnjohn");
328
335
  await vitest.waitFor(() => {
329
336
  expect(getInputAsset().validation).toBeDefined();
330
337
  expect(testExpression).not.toHaveBeenCalled();
@@ -334,7 +341,7 @@ describe("Data-Change-Listener with Validations", () => {
334
341
  it("bindings with a successful validation trigger listeners", async () => {
335
342
  expect(getInputAsset().validation).toBe(undefined);
336
343
 
337
- getInputAsset().set("Adam");
344
+ getInputAsset().set("john");
338
345
  await vitest.waitFor(() => {
339
346
  expect(getInputAsset().validation).not.toBeDefined();
340
347
  expect(testExpression).toHaveBeenCalled();