1
+ import { EntryModel } from '../src'
2
+ import { addTags } from '../src/entry-editable'
3
+ import { entry_global_field , entry_global_field_multiple , entry_modular_block , entry_reference , entry_with_text } from './mock/entry-editable-mock'
4
+ import { entryMultipleContent } from './mock/entry-multiple-rich-text-content'
5
+
6
+ describe ( 'Entry editable test' , ( ) => {
7
+ it ( 'Entry with text test' , done => {
8
+ addTags ( entry_with_text , 'entry_asset' , false )
9
+ expect ( ( entry_with_text as any ) [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.rich_text_editor' )
10
+ expect ( ( entry_with_text as any ) [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.rich_text_editor_multiple' )
11
+ done ( )
12
+ } )
13
+
14
+ it ( 'Entry with text should return object test' , done => {
15
+ addTags ( entry_with_text , 'entry_asset' , true )
16
+ expect ( ( entry_with_text as any ) [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' : 'entry_asset.bltcb70aa8425b4676c.en-us.rich_text_editor' } )
17
+ expect ( ( entry_with_text as any ) [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' : 'entry_asset.bltcb70aa8425b4676c.en-us.rich_text_editor_multiple' } )
18
+ done ( )
19
+ } )
20
+
21
+ it ( 'Entry with Modular blocks test' , done => {
22
+ addTags ( entry_modular_block , 'entry_multiple_content' , false )
23
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 0 ] [ 'rich_text_inmodular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.0.rich_text_inmodular.rich_text_editor' )
24
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 0 ] [ 'rich_text_inmodular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.0.rich_text_inmodular.rich_text_editor_multiple' )
25
+
26
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.rich_text_editor' )
27
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.rich_text_editor_multiple' )
28
+
29
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'group' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.group.rich_text_editor' )
30
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'group' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.group.rich_text_editor_multiple' )
31
+
32
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.modular_blocks.0.rich_in_modular.rich_text_editor' )
33
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.modular_blocks.0.rich_in_modular.rich_text_editor_multiple' )
34
+
35
+ done ( )
36
+ } )
37
+ it ( 'Entry with Modular blocks test return object' , done => {
38
+ addTags ( entry_modular_block , 'entry_multiple_content' , true )
39
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 0 ] [ 'rich_text_inmodular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.0.rich_text_inmodular.rich_text_editor' } )
40
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 0 ] [ 'rich_text_inmodular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.0.rich_text_inmodular.rich_text_editor_multiple' } )
41
+
42
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.rich_text_editor' } )
43
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.rich_text_editor_multiple' } )
44
+
45
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'group' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.group.rich_text_editor' } )
46
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'group' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.group.rich_text_editor_multiple' } )
47
+
48
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.modular_blocks.0.rich_in_modular.rich_text_editor' } )
49
+ expect ( ( entry_modular_block as any ) [ 'modular_blocks' ] [ 1 ] [ 'global_modular' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_multiple_content.bltcb70aa8425b4676c.en-us.modular_blocks.1.global_modular.modular_blocks.0.rich_in_modular.rich_text_editor_multiple' } )
50
+
51
+ done ( )
52
+ } )
53
+
54
+ it ( 'Entry with reference test' , done => {
55
+ addTags ( entry_reference , 'entry_asset' , false )
56
+
57
+ expect ( ( entry_reference as any ) [ 'reference' ] [ 0 ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=embed_entry.blt9c95983f8f327537.en-us.rich_text_editor' )
58
+ expect ( ( entry_reference as any ) [ 'reference' ] [ 0 ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=embed_entry.blt9c95983f8f327537.en-us.rich_text_editor_multiple' )
59
+
60
+ done ( )
61
+ } )
62
+
63
+ it ( 'Entry with reference should return object test' , done => {
64
+ addTags ( entry_reference , 'entry_asset' , true )
65
+
66
+ expect ( ( entry_reference as any ) [ 'reference' ] [ 0 ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'embed_entry.blt9c95983f8f327537.en-us.rich_text_editor' } )
67
+ expect ( ( entry_reference as any ) [ 'reference' ] [ 0 ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'embed_entry.blt9c95983f8f327537.en-us.rich_text_editor_multiple' } )
68
+
69
+ done ( )
70
+ } )
71
+
72
+ it ( 'Entry with global fields test' , done => {
73
+ addTags ( entry_global_field , 'entry_asset' , false )
74
+
75
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich.rich_text_editor' )
76
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich.rich_text_editor_multiple' )
77
+
78
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'group' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich.group.rich_text_editor' )
79
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'group' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich.group.rich_text_editor_multiple' )
80
+
81
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich.modular_blocks.0.rich_in_modular.rich_text_editor' )
82
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich.modular_blocks.0.rich_in_modular.rich_text_editor_multiple' )
83
+
84
+ done ( )
85
+ } )
86
+
87
+ it ( 'Entry with reference should return object test' , done => {
88
+ addTags ( entry_global_field , 'entry_asset' , true )
89
+
90
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich.rich_text_editor' } )
91
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich.rich_text_editor_multiple' } )
92
+
93
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'group' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich.group.rich_text_editor' } )
94
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'group' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich.group.rich_text_editor_multiple' } )
95
+
96
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich.modular_blocks.0.rich_in_modular.rich_text_editor' } )
97
+ expect ( ( entry_global_field as any ) [ 'global_rich' ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich.modular_blocks.0.rich_in_modular.rich_text_editor_multiple' } )
98
+
99
+ done ( )
100
+ } )
101
+
102
+ it ( 'Entry with reference test' , done => {
103
+ addTags ( entry_global_field_multiple , 'entry_asset' , false )
104
+
105
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.rich_text_editor' )
106
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.rich_text_editor_multiple' )
107
+
108
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'group' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.group.rich_text_editor' )
109
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'group' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.group.rich_text_editor_multiple' )
110
+
111
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.modular_blocks.0.rich_in_modular.rich_text_editor' )
112
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( 'data-cslp=entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.modular_blocks.0.rich_in_modular.rich_text_editor_multiple' )
113
+
114
+ done ( )
115
+ } )
116
+
117
+ it ( 'Entry with reference should return object test' , done => {
118
+ addTags ( entry_global_field_multiple , 'entry_asset' , true )
119
+
120
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.rich_text_editor' } )
121
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.rich_text_editor_multiple' } )
122
+
123
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'group' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.group.rich_text_editor' } )
124
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'group' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.group.rich_text_editor_multiple' } )
125
+
126
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.modular_blocks.0.rich_in_modular.rich_text_editor' } )
127
+ expect ( ( entry_global_field_multiple as any ) [ 'global_rich_multiple' ] [ 0 ] [ 'modular_blocks' ] [ 0 ] [ 'rich_in_modular' ] [ '$' ] [ 'rich_text_editor_multiple' ] ) . toEqual ( { 'data-cslp' :'entry_asset.bltcb70aa8425b4676c.en-us.global_rich_multiple.0.modular_blocks.0.rich_in_modular.rich_text_editor_multiple' } )
128
+
129
+ done ( )
130
+ } )
131
+
132
+ } )
0 commit comments