• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badetitou / Casino / 6588584769

20 Oct 2023 01:47PM UTC coverage: 45.319% (-0.009%) from 45.328%
6588584769

push

github

badetitou
rework isStub and components path

9 of 9 new or added lines in 2 files covered. (100.0%)

7203 of 15894 relevant lines covered (45.32%)

0.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.36
/src/Casino-Core-ExternalLibrary/WidgetRepresentation.class.st
1
Class {
2
        #name : #WidgetRepresentation,
3
        #superclass : #Object,
4
        #category : #'Casino-Core-ExternalLibrary'
5
}
6

7
{ #category : #export }
8
WidgetRepresentation >> angularActionRepresentationOf: action forWidget: aWidget using: anExporter [
1✔
9
        ^ anExporter <<< (action getAngularRepresentationWith: anExporter)
1✔
10
]
1✔
11

12
{ #category : #'accessing - export' }
13
WidgetRepresentation >> attributeDictionary [
1✔
14
        ^ {  } asDictionary
1✔
15
]
1✔
16

17
{ #category : #export }
18
WidgetRepresentation >> attributeNameInComponent: attribute [
1✔
19
        ^ self attributeDictionary at: attribute class ifAbsent: [ attribute name ]
1✔
20
]
1✔
21

22
{ #category : #export }
23
WidgetRepresentation >> attributeOf: aWidget with: anExporter [
1✔
24

1✔
25
        | attributes |
1✔
26
        attributes := aWidget computeSelfAttributes.
1✔
27
        attributes addAll: (anExporter
1✔
28
                         additionalAttributesForWidget: aWidget
1✔
29
                         withRepresentation: self).
1✔
30
        aWidget variable ifNotNil: [ :variable | 
1✔
31
                attributes add: (CSNUIId new attributeValue: aWidget id) ].
1✔
32
        ^ attributes
1✔
33
]
1✔
34

35
{ #category : #export }
36
WidgetRepresentation >> componentActionsOn: anExporter forWidget: aWidget [
1✔
37

1✔
38
        aWidget actions ifNotEmpty: [ 
1✔
39
                anExporter <<< ' '.
1✔
40
                aWidget actions
1✔
41
                        do: [ :action | 
1✔
42
                                self
1✔
43
                                        angularActionRepresentationOf: action
1✔
44
                                        forWidget: aWidget
1✔
45
                                        using: anExporter ]
1✔
46
                        separatedBy: [ anExporter <<< ' ' ] ]
1✔
47
]
1✔
48

49
{ #category : #export }
50
WidgetRepresentation >> componentAttributeOn: anExporter [
1✔
51
]
1✔
52

53
{ #category : #export }
54
WidgetRepresentation >> componentAttributeOn: anExporter forWidget: aWidget [
1✔
55
        | attributes |
1✔
56
        attributes := self attributeOf: aWidget with: anExporter.
1✔
57
        self exportAttributes: attributes with: anExporter.
1✔
58
        self componentAttributeOn: anExporter
1✔
59
]
1✔
60

61
{ #category : #export }
62
WidgetRepresentation >> export: aWidget with: anExporter [
1✔
63
        self exportHeaderOf: aWidget with: anExporter.
1✔
64
        self exportContentOf: aWidget with: anExporter.
1✔
65
        self exportFooterOf: aWidget with: anExporter.
1✔
66
]
1✔
67

68
{ #category : #export }
69
WidgetRepresentation >> exportAttribute: attribute with: anExporter [
1✔
70

1✔
71
        anExporter exportAttributeValue: attribute
1✔
72
        
1✔
73
]
1✔
74

75
{ #category : #export }
76
WidgetRepresentation >> exportAttributes: attributes with: anExporter [
1✔
77

1✔
78
        ^ ((attributes flattened reject: [ :att | att name isNil ])  
1✔
79
                   groupedBy: [ :attribute | 
1✔
80
                   self attributeNameInComponent: attribute ]) asDictionary 
1✔
81
                  associationsDo: [ :mapAttributeNameValues | 
1✔
82
                          anExporter
1✔
83
                                  <<< ' ';
1✔
84
                                  <<< mapAttributeNameValues key;
1✔
85
                                  <<< '="'.
1✔
86
                          mapAttributeNameValues value asOrderedCollection
1✔
87
                                  do: [ :attribute | anExporter visit: attribute ]
1✔
88
                                  separatedBy: [ anExporter <<< ' ' ].
1✔
89
                          anExporter <<< '"' ]
1✔
90
]
1✔
91

92
{ #category : #export }
93
WidgetRepresentation >> exportContentOf: aWidget with: anExporter [
1✔
94
        aWidget widgets
1✔
95
                do: [ :widget | 
1✔
96
                        anExporter
1✔
97
                                eol;
1✔
98
                                indentPlus.
1✔
99
                        anExporter
1✔
100
                                visit: widget;
1✔
101
                                indentMinus ]
1✔
102
]
1✔
103

104
{ #category : #export }
105
WidgetRepresentation >> exportFooterOf: aWidget with: anExporter [
1✔
106
        anExporter
1✔
107
                eol;
1✔
108
                << '</';
1✔
109
                <<< (self getSelector);
1✔
110
                <<< '>'
1✔
111
]
1✔
112

113
{ #category : #export }
114
WidgetRepresentation >> exportHeaderOf: aWidget with: anExporter [
1✔
115
        anExporter << '<'.
1✔
116
        self exportListPropertiesOf: aWidget asStringWith: anExporter.
1✔
117
        anExporter <<< '>'
1✔
118
]
1✔
119

120
{ #category : #export }
121
WidgetRepresentation >> exportListPropertiesOf: aWidget asStringWith: anExporter [
1✔
122

1✔
123
        anExporter <<< self getSelector.
1✔
124
        self componentAttributeOn: anExporter forWidget: aWidget.
1✔
125
        self componentActionsOn: anExporter forWidget: aWidget
1✔
126
        "anExporter <<< aWidget idTag"
1✔
127
]
1✔
128

129
{ #category : #'export - typescript' }
130
WidgetRepresentation >> exportTypeScriptConstructorInjectionOf: widget usingExporter: anExporter [
×
131
        "I export in the TS injection in the constructor for my widget"
×
132
]
×
133

134
{ #category : #'export - typescript' }
135
WidgetRepresentation >> exportTypeScriptImportOf: widget usingExporter: anExporter [
×
136
        "I export in the TS component of my widget the variables required for its proper working"
×
137
]
×
138

139
{ #category : #'export - typescript' }
140
WidgetRepresentation >> exportTypeScriptMethodsOf: widget usingExporter: anExporter [
×
141
        "I export in the TS component of my widget the variables required for its proper working"
×
142
]
×
143

144
{ #category : #'export - typescript' }
145
WidgetRepresentation >> exportTypeScriptOnDestroyOf: widget usingExporter: anExporter [
×
146

×
147
        "I export in the TS code inside ngOnInit of my widget.
×
148
        It is often about inizializing some attributes"
×
149

×
150
        
×
151
]
×
152

153
{ #category : #'export - typescript' }
154
WidgetRepresentation >> exportTypeScriptOnInitOf: widget usingExporter: anExporter [
×
155

×
156
        "I export in the TS code inside ngOnInit of my widget.
×
157
        It is often about inizializing some attributes"
×
158

×
159
        
×
160
]
×
161

162
{ #category : #'export - typescript' }
163
WidgetRepresentation >> exportTypeScriptVariableOf: widget usingExporter: anExporter [
×
164
        "I export in the TS component of my widget the variables required for its proper working"
×
165
]
×
166

167
{ #category : #'accessing - form' }
168
WidgetRepresentation >> extractFormContainerOf: aWidget with: anExporter [
×
169

×
170
        ^ ((aWidget
×
171
                    allAtScope: CSNWidget
×
172
                    until: [ :w | 
×
173
                    (anExporter angularRepresentationOf: w) isFormContainer ]) 
×
174
                   select: [ :w | 
×
175
                   (anExporter angularRepresentationOf: w) isFormContainer ]) anyOne
×
176
]
×
177

178
{ #category : #accessing }
179
WidgetRepresentation >> getSelector [
1✔
180
        ^ 'div'
1✔
181
]
1✔
182

183
{ #category : #accessing }
184
WidgetRepresentation >> getSubWidgets: aWidget usingExporter: anExporter [
×
185

×
186
        ^ (aWidget widgets , (aWidget isContainer
×
187
                    ifTrue: [ 
×
188
                            aWidget layout
×
189
                                    ifNotNil: [ :a | a cell collect: #widget thenReject: #isNil ]
×
190
                                    ifNil: [ {  } ] ]
×
191
                    ifFalse: [ {  } ]) reject: [ :el | el = aWidget ]) reject: [ :w | 
×
192
                  (anExporter angularRepresentationOf: w) isSubComponent: w ]
×
193
]
×
194

195
{ #category : #'accessing - export' }
196
WidgetRepresentation >> getTypeScriptExtendsRequiredBy: widget usingExporter: anExporter [
×
197

×
198
        "I return the list of extend of the root component this representation need.
×
199
        If multiple component in the same DOM tree have this set to something, it might create huge problem"
×
200

×
201
        ^ {  }
×
202
]
×
203

204
{ #category : #'accessing - export' }
205
WidgetRepresentation >> getTypeScriptSuperRequiredBy: widget usingExporter: anExporter [
×
206

×
207
        "I return the list of super() of the root component this representation need.
×
208
        If multiple component in the same DOM tree have this set to something, it might create huge problem"
×
209

×
210
        ^ {  }
×
211
]
×
212

213
{ #category : #'export - typescript' }
214
WidgetRepresentation >> importString [
×
215
        ^ 'import { ' , self moduleName , ' } from ''' , self modulePath , ''';'
×
216
]
×
217

218
{ #category : #'export - typescript' }
219
WidgetRepresentation >> importStringOf: aWidget [
×
220

×
221
        ^ self importString
×
222
]
×
223

224
{ #category : #accessing }
225
WidgetRepresentation >> internalDependenciesOf: aWidgetInstance [
×
226

×
227
        ^ {  }
×
228
]
×
229

230
{ #category : #'accessing - form' }
231
WidgetRepresentation >> isFormContainer [
×
232
        "If true this representation support the formControl"
×
233
        ^ false
×
234
]
×
235

236
{ #category : #'accessing - form' }
237
WidgetRepresentation >> isFormControl [
×
238
        "If true this representation support the formControl"
×
239
        ^ false
×
240
]
×
241

242
{ #category : #'accessing - testing' }
243
WidgetRepresentation >> isLocal [
×
244
        "The widget is NOT imported from a distant library
×
245
        It is already part of the exported project"
×
246
        ^ true
×
247
]
×
248

249
{ #category : #'accessing - testing' }
250
WidgetRepresentation >> isNative [
×
251
        "The widget is part of the html standard"
×
252
        ^ true
×
253
]
×
254

255
{ #category : #'accessing - testing' }
256
WidgetRepresentation >> isOverrideLayout [
1✔
257

1✔
258
        "If true this representation ask to bypass the classic export of layout because it deals with it in the `exportContentOf:with:` method "
1✔
259

1✔
260
        ^ false
1✔
261
]
1✔
262

263
{ #category : #'accessing - testing' }
264
WidgetRepresentation >> isSubComponent: aWidget [
×
265
        "If true this representation will be exported as a component"
×
266
        ^ false
×
267
]
×
268

269
{ #category : #accessing }
270
WidgetRepresentation >> moduleName [
×
271

×
272
        ^ 'ElementRef'
×
273
]
×
274

275
{ #category : #accessing }
276
WidgetRepresentation >> modulePath [
×
277
        ^ '@angular/core'
×
278
]
×
279

280
{ #category : #accessing }
281
WidgetRepresentation >> representationSubWidgetsOf: aWidget usingExporter: anExporter [
×
282

×
283
        "la liste des widgets en dessous du widget courant, filtré si besoin "
×
284

×
285
        | subs |
×
286
        subs := self getSubWidgets: aWidget usingExporter: anExporter.
×
287

×
288
        ^ subs , (subs collect: [ :w | 
×
289
                  (anExporter angularRepresentationOf: w)
×
290
                          representationSubWidgetsOf: w
×
291
                          usingExporter: anExporter ])
×
292
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc