ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / browserView / test / common / cssHelpers.test.ts 378 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
import assert from 'assert' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { collapseToShorthands, formatMatchedStyles, type IMatchedStyles } from '../../common/cssHelpers.js' ;
function collapse ( props: Record< string , string > ) : string [ ] {
return collapseToShorthands ( new Map ( Object. entries ( props)
assert
assert
assert
assert
assert
assert
result
assert result
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
result
assert result
selector cssText origin rule selectorList selectors text origin style cssText cssProperties name value
props cssText d d Boolean d
name rest d
name name value rest
rule selectorList selectors text selector origin style cssText cssProperties props
matched IMatchedStyles
matchedCSSRules
rulesText matched
assert rulesText
assert rulesText
assert rulesText
matched IMatchedStyles
matchedCSSRules
pseudoElements
pseudoType
matches
pseudoType
matches
rulesText matched
assert rulesText
assert rulesText
assert rulesText
assert rulesText
matched IMatchedStyles
matchedCSSRules
pseudoElements
pseudoType
matches
rulesText matched
assert rulesText
matched IMatchedStyles
matchedCSSRules
inherited
matchedCSSRules
rulesText matched
assert rulesText
assert rulesText
assert rulesText
matched IMatchedStyles
matchedCSSRules
referencedVars matched
assert referencedVars
assert referencedVars
matched IMatchedStyles
matchedCSSRules
rule
selectorList selectors text
origin
style
cssText
cssProperties
name value
name value
name value
authorPropertyNames matched
assert authorPropertyNames
assert authorPropertyNames
assert authorPropertyNames
assert authorPropertyNames
matched IMatchedStyles
matchedCSSRules
userAgentPropertyNames matched
assert userAgentPropertyNames
assert userAgentPropertyNames
assert userAgentPropertyNames
matched IMatchedStyles
matchedCSSRules
pseudoElements
pseudoType
matches
userAgentPropertyNames matched
assert userAgentPropertyNames
assert userAgentPropertyNames
matched IMatchedStyles
matchedCSSRules
inherited
matchedCSSRules
userAgentPropertyNames matched
assert userAgentPropertyNames
assert userAgentPropertyNames
)
)
;
}
suite
(
'collapseToShorthands'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'margin: all sides equal → 1-value'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'margin-top'
:
'10px'
,
'margin-right'
:
'10px'
,
'margin-bottom'
:
'10px'
,
'margin-left'
:
'10px'
,
}
)
,
[
'margin: 10px;'
]
)
;
}
)
;
test
(
'padding: vertical/horizontal → 2-value'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'padding-top'
:
'4px'
,
'padding-right'
:
'12px'
,
'padding-bottom'
:
'4px'
,
'padding-left'
:
'12px'
,
}
)
,
[
'padding: 4px 12px;'
]
)
;
}
)
;
test
(
'margin: 3-value when left === right'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'margin-top'
:
'10px'
,
'margin-right'
:
'5px'
,
'margin-bottom'
:
'20px'
,
'margin-left'
:
'5px'
,
}
)
,
[
'margin: 10px 5px 20px;'
]
)
;
}
)
;
test
(
'margin: 4-value when all differ'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'margin-top'
:
'1px'
,
'margin-right'
:
'2px'
,
'margin-bottom'
:
'3px'
,
'margin-left'
:
'4px'
,
}
)
,
[
'margin: 1px 2px 3px 4px;'
]
)
;
}
)
;
test
(
'border-radius: uniform'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'border-top-left-radius'
:
'6px'
,
'border-top-right-radius'
:
'6px'
,
'border-bottom-right-radius'
:
'6px'
,
'border-bottom-left-radius'
:
'6px'
,
}
)
,
[
'border-radius: 6px;'
]
)
;
}
)
;
test
(
'border: uniform sides → single shorthand'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'border-top-width'
:
'1px'
,
'border-right-width'
:
'1px'
,
'border-bottom-width'
:
'1px'
,
'border-left-width'
:
'1px'
,
'border-top-style'
:
'solid'
,
'border-right-style'
:
'solid'
,
'border-bottom-style'
:
'solid'
,
'border-left-style'
:
'solid'
,
'border-top-color'
:
'red'
,
'border-right-color'
:
'red'
,
'border-bottom-color'
:
'red'
,
'border-left-color'
:
'red'
,
}
)
,
[
'border: 1px solid red;'
]
)
;
}
)
;
test
(
'border: non-uniform → per-group shorthands'
,
(
)
=>
{
const
=
collapse
(
{
'border-top-width'
:
'1px'
,
'border-right-width'
:
'2px'
,
'border-bottom-width'
:
'1px'
,
'border-left-width'
:
'2px'
,
'border-top-style'
:
'solid'
,
'border-right-style'
:
'solid'
,
'border-bottom-style'
:
'solid'
,
'border-left-style'
:
'solid'
,
'border-top-color'
:
'red'
,
'border-right-color'
:
'red'
,
'border-bottom-color'
:
'red'
,
'border-left-color'
:
'red'
,
}
)
;
.
deepStrictEqual
(
,
[
'border-width: 1px 2px;'
,
'border-style: solid;'
,
'border-color: red;'
,
]
)
;
}
)
;
test
(
'border-image at defaults → dropped entirely'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'border-image-source'
:
'none'
,
'border-image-slice'
:
'100%'
,
'border-image-width'
:
'1'
,
'border-image-outset'
:
'0'
,
'border-image-repeat'
:
'stretch'
,
'color'
:
'red'
,
}
)
,
[
'color: red;'
]
)
;
}
)
;
test
(
'animation-range at defaults → dropped'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'animation-range-start'
:
'normal'
,
'animation-range-end'
:
'normal'
,
'display'
:
'block'
,
}
)
,
[
'display: block;'
]
)
;
}
)
;
test
(
'background: color-only when others at default'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'background-color'
:
'rgb(255, 0, 0)'
,
'background-image'
:
'none'
,
'background-position-x'
:
'0px'
,
'background-position-y'
:
'0px'
,
'background-size'
:
'auto'
,
'background-repeat'
:
'repeat'
,
'background-attachment'
:
'scroll'
,
'background-origin'
:
'padding-box'
,
'background-clip'
:
'border-box'
,
}
)
,
[
'background: rgb(255, 0, 0);'
]
)
;
}
)
;
test
(
'text-decoration: none'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'text-decoration-line'
:
'none'
,
'text-decoration-style'
:
'solid'
,
'text-decoration-color'
:
'currentcolor'
,
'text-decoration-thickness'
:
'auto'
,
}
)
,
[
'text-decoration: none;'
]
)
;
}
)
;
test
(
'text-decoration: underline with non-default style'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'text-decoration-line'
:
'underline'
,
'text-decoration-style'
:
'wavy'
,
'text-decoration-color'
:
'currentcolor'
,
'text-decoration-thickness'
:
'auto'
,
}
)
,
[
'text-decoration: underline wavy;'
]
)
;
}
)
;
test
(
'white-space: nowrap'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'white-space-collapse'
:
'collapse'
,
'text-wrap-mode'
:
'nowrap'
,
}
)
,
[
'white-space: nowrap;'
]
)
;
}
)
;
test
(
'white-space: pre-wrap'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'white-space-collapse'
:
'preserve'
,
'text-wrap-mode'
:
'wrap'
,
}
)
,
[
'white-space: pre-wrap;'
]
)
;
}
)
;
test
(
'transition: single property with cubic-bezier'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'transition-property'
:
'opacity'
,
'transition-duration'
:
'0.5s'
,
'transition-timing-function'
:
'cubic-bezier(0.16, 1, 0.3, 1)'
,
'transition-delay'
:
'0s'
,
'transition-behavior'
:
'normal'
,
}
)
,
[
'transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);'
]
)
;
}
)
;
test
(
'transition: multi-property comma-separated'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'transition-property'
:
'opacity, transform'
,
'transition-duration'
:
'0.5s, 0.3s'
,
'transition-timing-function'
:
'ease, ease'
,
'transition-delay'
:
'0s, 0s'
,
'transition-behavior'
:
'normal, normal'
,
}
)
,
[
'transition: opacity 0.5s, transform 0.3s;'
]
)
;
}
)
;
test
(
'animation: name and duration only'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'animation-name'
:
'fadeIn'
,
'animation-duration'
:
'0.3s'
,
'animation-timing-function'
:
'ease'
,
'animation-delay'
:
'0s'
,
'animation-iteration-count'
:
'1'
,
'animation-direction'
:
'normal'
,
'animation-fill-mode'
:
'none'
,
'animation-play-state'
:
'running'
,
'animation-timeline'
:
'auto'
,
}
)
,
[
'animation: fadeIn 0.3s;'
]
)
;
}
)
;
test
(
'animation: with fill-mode and custom easing'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'animation-name'
:
'slideIn'
,
'animation-duration'
:
'0.5s'
,
'animation-timing-function'
:
'ease-in-out'
,
'animation-delay'
:
'0s'
,
'animation-iteration-count'
:
'1'
,
'animation-direction'
:
'normal'
,
'animation-fill-mode'
:
'forwards'
,
'animation-play-state'
:
'running'
,
'animation-timeline'
:
'auto'
,
}
)
,
[
'animation: slideIn 0.5s ease-in-out forwards;'
]
)
;
}
)
;
test
(
'unknown properties pass through alphabetically'
,
(
)
=>
{
.
deepStrictEqual
(
collapse
(
{
'z-index'
:
'1'
,
'color'
:
'red'
,
'display'
:
'flex'
,
}
)
,
[
'color: red;'
,
'display: flex;'
,
'z-index: 1;'
]
)
;
}
)
;
test
(
'realistic element with multiple shorthand groups'
,
(
)
=>
{
const
=
collapse
(
{
'padding-top'
:
'4px'
,
'padding-right'
:
'12px'
,
'padding-bottom'
:
'4px'
,
'padding-left'
:
'12px'
,
'border-top-left-radius'
:
'6px'
,
'border-top-right-radius'
:
'6px'
,
'border-bottom-right-radius'
:
'6px'
,
'border-bottom-left-radius'
:
'6px'
,
'border-top-width'
:
'1px'
,
'border-right-width'
:
'1px'
,
'border-bottom-width'
:
'1px'
,
'border-left-width'
:
'1px'
,
'border-top-style'
:
'solid'
,
'border-right-style'
:
'solid'
,
'border-bottom-style'
:
'solid'
,
'border-left-style'
:
'solid'
,
'border-top-color'
:
'rgb(209, 217, 224)'
,
'border-right-color'
:
'rgb(209, 217, 224)'
,
'border-bottom-color'
:
'rgb(209, 217, 224)'
,
'border-left-color'
:
'rgb(209, 217, 224)'
,
'border-image-source'
:
'none'
,
'border-image-slice'
:
'100%'
,
'border-image-width'
:
'1'
,
'border-image-outset'
:
'0'
,
'border-image-repeat'
:
'stretch'
,
'background-color'
:
'rgba(0, 0, 0, 0)'
,
'background-image'
:
'none'
,
'background-position-x'
:
'0px'
,
'background-position-y'
:
'0px'
,
'background-size'
:
'auto'
,
'background-repeat'
:
'repeat'
,
'background-attachment'
:
'scroll'
,
'background-origin'
:
'padding-box'
,
'background-clip'
:
'border-box'
,
'text-decoration-line'
:
'none'
,
'text-decoration-style'
:
'solid'
,
'text-decoration-color'
:
'currentcolor'
,
'text-decoration-thickness'
:
'auto'
,
'white-space-collapse'
:
'collapse'
,
'text-wrap-mode'
:
'nowrap'
,
'transition-property'
:
'opacity, transform'
,
'transition-duration'
:
'0.5s, 0.5s'
,
'transition-timing-function'
:
'cubic-bezier(0.16, 1, 0.3, 1), cubic-bezier(0.16, 1, 0.3, 1)'
,
'transition-delay'
:
'0s, 0s'
,
'transition-behavior'
:
'normal, normal'
,
'color'
:
'rgb(255, 255, 255)'
,
'display'
:
'inline-flex'
,
'font-size'
:
'14px'
,
}
)
;
.
deepStrictEqual
(
,
[
'padding: 4px 12px;'
,
'border-radius: 6px;'
,
'border: 1px solid rgb(209, 217, 224);'
,
'background: rgba(0, 0, 0, 0);'
,
'text-decoration: none;'
,
'white-space: nowrap;'
,
'transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);'
,
'color: rgb(255, 255, 255);'
,
'display: inline-flex;'
,
'font-size: 14px;'
,
]
)
;
}
)
;
}
)
;
function
rule
(
:
string
,
:
string
,
=
'regular'
)
:
{
:
{
:
{
:
{
:
string
}
[
]
}
;
:
string
;
:
{
:
string
;
:
{
:
string
;
:
string
}
[
]
}
}
}
{
const
=
.
split
(
';'
)
.
map
(
=>
.
trim
(
)
)
.
filter
(
)
.
map
(
=>
{
const
[
,
...
]
=
.
split
(
':'
)
;
return
{
:
.
trim
(
)
,
:
.
join
(
':'
)
.
trim
(
)
}
;
}
)
;
return
{
:
{
:
{
:
[
{
:
}
]
}
,
,
:
{
,
:
}
}
}
;
}
suite
(
'formatAuthorStyles'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'includes direct author rules and skips user-agent'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.btn'
,
'padding: 8px; color: white;'
)
,
rule
(
'button'
,
'display: inline-block;'
,
'user-agent'
)
,
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
includes
(
'.btn'
)
)
;
.
ok
(
.
includes
(
'padding: 8px'
)
)
;
.
ok
(
!
.
includes
(
'display: inline-block'
)
)
;
}
)
;
test
(
'includes pseudo-element styles'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.btn'
,
'color: white;'
)
]
,
:
[
{
:
'before'
,
:
[
rule
(
'.btn::before'
,
'content: "→"; color: red;'
)
]
,
}
,
{
:
'after'
,
:
[
rule
(
'.btn::after'
,
'content: "✓"; color: green;'
)
]
,
}
,
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
includes
(
'/* Pseudo-elements */'
)
)
;
.
ok
(
.
includes
(
'.btn::before'
)
)
;
.
ok
(
.
includes
(
'.btn::after'
)
)
;
.
ok
(
.
includes
(
'content: "→"'
)
)
;
}
)
;
test
(
'skips user-agent pseudo-element rules'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.x'
,
'color: red;'
)
]
,
:
[
{
:
'before'
,
:
[
rule
(
'input::before'
,
'content: "";'
,
'user-agent'
)
]
,
}
,
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
!
.
includes
(
'Pseudo-elements'
)
)
;
}
)
;
test
(
'filters inherited rules to inheritable properties only'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.child'
,
'display: flex;'
)
]
,
:
[
{
:
[
rule
(
'body'
,
'font-family: sans-serif; background: red; margin: 0;'
)
]
,
}
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
includes
(
'font-family: sans-serif'
)
)
;
.
ok
(
!
.
includes
(
'background'
)
)
;
.
ok
(
!
.
includes
(
'margin'
)
)
;
}
)
;
test
(
'collects var references from rules'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.x'
,
'color: var(--fg-color); border: var(--border-width) solid;'
)
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
has
(
'--fg-color'
)
)
;
.
ok
(
.
has
(
'--border-width'
)
)
;
}
)
;
test
(
'tracks author property names from cssProperties longhands'
,
(
)
=>
{
const
:
=
{
:
[
{
:
{
:
{
:
[
{
:
'.x'
}
]
}
,
:
'regular'
,
:
{
:
'border: 1px solid red;'
,
:
[
{
:
'border-top-width'
,
:
'1px'
}
,
{
:
'border-top-style'
,
:
'solid'
}
,
{
:
'border-top-color'
,
:
'red'
}
,
]
,
}
,
}
,
}
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
has
(
'border-top-width'
)
)
;
.
ok
(
.
has
(
'border-top-style'
)
)
;
.
ok
(
.
has
(
'display'
)
)
;
.
ok
(
.
has
(
'width'
)
)
;
}
)
;
test
(
'tracks user-agent property names from direct rules'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.btn'
,
'color: white;'
)
,
rule
(
'button'
,
'display: inline-block; padding: 2px;'
,
'user-agent'
)
,
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
has
(
'display'
)
)
;
.
ok
(
.
has
(
'padding'
)
)
;
.
ok
(
!
.
has
(
'color'
)
)
;
}
)
;
test
(
'tracks user-agent property names from pseudo-element rules'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.x'
,
'color: red;'
)
]
,
:
[
{
:
'before'
,
:
[
rule
(
'input::before'
,
'content: ""; display: block;'
,
'user-agent'
)
]
,
}
,
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
has
(
'content'
)
)
;
.
ok
(
.
has
(
'display'
)
)
;
}
)
;
test
(
'tracks user-agent property names from inherited rules (inheritable only)'
,
(
)
=>
{
const
:
=
{
:
[
rule
(
'.child'
,
'display: flex;'
)
]
,
:
[
{
:
[
rule
(
'body'
,
'font-family: sans-serif; margin: 0;'
,
'user-agent'
)
]
,
}
]
,
}
;
const
{
}
=
formatMatchedStyles
(
)
;
.
ok
(
.
has
(
'font-family'
)
)
;
.
ok
(
!
.
has
(
'margin'
)
)
;
}
)
;
}
)
;