File tree 2 files changed +45
-0
lines changed
2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ customName: {
25
25
}
26
26
```
27
27
28
+ Read more about the full object property descriptor in the [ Structure] ( /component-model/structure.md#value ) section.
29
+
28
30
### Attributes
29
31
30
32
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
45
47
}
46
48
```
47
49
50
+ Read more about the attribute synchronization in the [ Structure] ( /component-model/structure.md#reflect ) section.
51
+
48
52
### Render and Content
49
53
50
54
#### Names
Original file line number Diff line number Diff line change @@ -63,6 +63,17 @@ describe("store:", () => {
63
63
expect ( ( ) => store . get ( { value : null } ) ) . toThrow ( ) ;
64
64
} ) ;
65
65
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
+
66
77
it ( "throws when nested object is used as a primary model" , ( ) => {
67
78
store . get ( Model , "1" ) ;
68
79
expect ( ( ) => {
@@ -386,6 +397,20 @@ describe("store:", () => {
386
397
) . toThrow ( ) ;
387
398
} ) ;
388
399
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
+
389
414
it ( "rejects an error when array with external objects is set with wrong type" , async ( ) => {
390
415
const model = await promise ;
391
416
expect ( ( ) =>
@@ -420,6 +445,22 @@ describe("store:", () => {
420
445
} ) ;
421
446
} ) ;
422
447
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
+
423
464
it ( "returns a placeholder in error state for not found singleton model" , ( ) => {
424
465
Model = {
425
466
value : "test" ,
You can’t perform that action at this time.
0 commit comments