Skip to content

Commit a2b3a34

Browse files
committed
Fixes
1 parent 527d351 commit a2b3a34

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

docs/migration.md

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ customName: {
2525
}
2626
```
2727

28+
Read more about the full object property descriptor in the [Structure](/component-model/structure.md#value) section.
29+
2830
### Attributes
2931

3032
Writable properties are no longer automatically synchronized back to the attribute. You must set the `reflect` option to enable the synchronization:
@@ -45,6 +47,8 @@ Writable properties are no longer automatically synchronized back to the attribu
4547
}
4648
```
4749

50+
Read more about the attribute synchronization in the [Structure](/component-model/structure.md#reflect) section.
51+
4852
### Render and Content
4953

5054
#### Names

test/spec/store.js

+41
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ describe("store:", () => {
6363
expect(() => store.get({ value: null })).toThrow();
6464
});
6565

66+
it("throws an error when get method returns string", () => {
67+
Model = {
68+
value: "test",
69+
[store.connect]: {
70+
get: () => "test",
71+
},
72+
};
73+
74+
expect(() => store.get(Model)).toThrow();
75+
});
76+
6677
it("throws when nested object is used as a primary model", () => {
6778
store.get(Model, "1");
6879
expect(() => {
@@ -386,6 +397,20 @@ describe("store:", () => {
386397
).toThrow();
387398
});
388399

400+
it("throws an error when set method returns undefined", () => {
401+
Model = {
402+
value: "test",
403+
[store.connect]: {
404+
get: () => ({}),
405+
set: () => {
406+
return "test";
407+
},
408+
},
409+
};
410+
411+
expect(() => store.set(Model)).toThrow();
412+
});
413+
389414
it("rejects an error when array with external objects is set with wrong type", async () => {
390415
const model = await promise;
391416
expect(() =>
@@ -420,6 +445,22 @@ describe("store:", () => {
420445
});
421446
});
422447

448+
it("rejects an error when set method returns promise resolving to string", () => {
449+
Model = {
450+
value: "test",
451+
[store.connect]: {
452+
get: () => ({}),
453+
set: async () => {
454+
return "test";
455+
},
456+
},
457+
};
458+
459+
return store.set(Model).catch((e) => {
460+
expect(e).toBeInstanceOf(Error);
461+
});
462+
});
463+
423464
it("returns a placeholder in error state for not found singleton model", () => {
424465
Model = {
425466
value: "test",

0 commit comments

Comments
 (0)