mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-21 22:18:13 +02:00
Trois défauts sans rapport entre eux, tous visibles à l'écran. Jauge de contexte bloquée à « 0 / N (0 %) » : le comptage exact vient de usage.prompt_tokens (include_usage), qu'un llama-server récent a cessé de renvoyer. On note désormais si l'usage est arrivé ; sinon la fin de tour publie l'estimation qui pilote déjà la compaction — approximative, mais jamais absente. Et la souscription envoie la valeur courante juste après le rattrapage : une page rechargée affichait zéro sur une discussion pourtant pleine, faute d'événement ctx_used dans la fenêtre rejouée. Espace disque : « il ne reste que 11,9 Go » sur un partage Unraid qui en a des centaines. /mnt/user est servi par shfs, un FUSE qui agrège plusieurs disques — statfs y renvoie l'espace d'un seul, et ce chiffre REFUSAIT l'installation du modèle. Les systèmes de fichiers qui approximent (FUSE, overlay, NFS, CIFS, Ceph, Gluster) sont reconnus par leur magie : leur chiffre reste affiché, précédé d'un « ~ », mais ne bloque plus rien. Panneau Fichiers : le panneau entier défilait, emportant vers le haut l'en-tête, le fil d'Ariane et le pied (occupation disque, bouton .zip) dès qu'il y avait quelques fichiers. Seule la liste défile maintenant ; le pied reste en bas et l'état vide se centre. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
130 lines
3.7 KiB
TypeScript
130 lines
3.7 KiB
TypeScript
import styleToJS = require('.');
|
|
|
|
it('exposes itself as default', () => {
|
|
expect(styleToJS).toBe(styleToJS.default);
|
|
});
|
|
|
|
it('parses empty style to object', () => {
|
|
expect(styleToJS('')).toEqual({});
|
|
});
|
|
|
|
it('does not parse CSS comment', () => {
|
|
expect(styleToJS('/* comment */')).toEqual({});
|
|
});
|
|
|
|
// invalid argument
|
|
it.each([undefined, null, 0, 1, true, false, {}, [], () => {}, new Date()])(
|
|
'parses "%s" to empty object',
|
|
(text) => {
|
|
expect(styleToJS(text as string)).toEqual({});
|
|
},
|
|
);
|
|
|
|
it.each(['top:', ':12px', ':', ';'])('parses "%s" to empty object', (text) => {
|
|
expect(styleToJS(text)).toEqual({});
|
|
});
|
|
|
|
it('parses common styles to object', () => {
|
|
const style = `
|
|
color: #f00;
|
|
font-size: 42px;
|
|
z-index: -1;
|
|
`;
|
|
expect(styleToJS(style)).toMatchInlineSnapshot(`
|
|
{
|
|
"color": "#f00",
|
|
"fontSize": "42px",
|
|
"zIndex": "-1",
|
|
}
|
|
`);
|
|
});
|
|
|
|
it('parses style with vendor prefix to object', () => {
|
|
const style = `
|
|
display: -ms-grid;
|
|
display: grid;
|
|
-webkit-transition: all .5s;
|
|
-o-transition: all .5s;
|
|
transition: all .5s;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
user-select: none;
|
|
background: -webkit-gradient(linear, left top, left bottom, from(white), to(black));
|
|
background: -o-linear-gradient(top, white, black);
|
|
background: linear-gradient(to bottom, white, black);
|
|
`;
|
|
expect(styleToJS(style)).toMatchInlineSnapshot(`
|
|
{
|
|
"background": "linear-gradient(to bottom, white, black)",
|
|
"display": "grid",
|
|
"mozUserSelect": "none",
|
|
"msUserSelect": "none",
|
|
"oTransition": "all .5s",
|
|
"transition": "all .5s",
|
|
"userSelect": "none",
|
|
"webkitTransition": "all .5s",
|
|
"webkitUserSelect": "none",
|
|
}
|
|
`);
|
|
});
|
|
|
|
it('parses background style to object', () => {
|
|
const style =
|
|
'background: url(data:image/png; base64,ivborw0kggoaaaansaaaabgdbtueaalgpc/xhbqaaaafzmuexurczmzpf399fx1+bm5mzy9avzxbesmgces5/p8/t9furvcrmu73jwlzosgsiizurcjo/ad+eqjjb4hv8bft+idpqocx1wjosbfhh2xssxeiyn3uli/6mnree07uiwjev8u8czwyuqdlkpg1bkb4nnm+veanfhqn1k4+gpt6ugqcvu2h2ovuif)';
|
|
expect(styleToJS(style)).toMatchInlineSnapshot(`
|
|
{
|
|
"background": "url(data:image/png; base64,ivborw0kggoaaaansaaaabgdbtueaalgpc/xhbqaaaafzmuexurczmzpf399fx1+bm5mzy9avzxbesmgces5/p8/t9furvcrmu73jwlzosgsiizurcjo/ad+eqjjb4hv8bft+idpqocx1wjosbfhh2xssxeiyn3uli/6mnree07uiwjev8u8czwyuqdlkpg1bkb4nnm+veanfhqn1k4+gpt6ugqcvu2h2ovuif)",
|
|
}
|
|
`);
|
|
});
|
|
|
|
it('parses style with no spaces to object', () => {
|
|
const style =
|
|
'border-bottom-left-radius:1em;border-right-style:solid;Z-Index:-1;-moz-border-radius-bottomleft:20px';
|
|
expect(styleToJS(style)).toMatchInlineSnapshot(`
|
|
{
|
|
"borderBottomLeftRadius": "1em",
|
|
"borderRightStyle": "solid",
|
|
"mozBorderRadiusBottomleft": "20px",
|
|
"zIndex": "-1",
|
|
}
|
|
`);
|
|
});
|
|
|
|
describe('when option reactCompat is true', () => {
|
|
const options = { reactCompat: true };
|
|
|
|
it('capitalizes vendor prefixes', () => {
|
|
const style = `
|
|
-khtml-user-select: none;
|
|
-moz-user-select: -moz-none;
|
|
-o-user-select: none;
|
|
-webkit-user-select: none;
|
|
user-select: none;
|
|
`;
|
|
expect(styleToJS(style, options)).toMatchInlineSnapshot(`
|
|
{
|
|
"KhtmlUserSelect": "none",
|
|
"MozUserSelect": "-moz-none",
|
|
"OUserSelect": "none",
|
|
"WebkitUserSelect": "none",
|
|
"userSelect": "none",
|
|
}
|
|
`);
|
|
});
|
|
|
|
it('does not capitalize ms prefixes', () => {
|
|
const style = `
|
|
-ms-transform: none;
|
|
-ms-user-select: none;
|
|
`;
|
|
expect(styleToJS(style, options)).toMatchInlineSnapshot(`
|
|
{
|
|
"msTransform": "none",
|
|
"msUserSelect": "none",
|
|
}
|
|
`);
|
|
});
|
|
});
|