@seniorsistemas/angular-components 19.7.4 → 19.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/lib/alert/alert.component.d.ts +8 -1
- package/chips/README.md +3 -2
- package/chips/lib/chips/chip-item/chip-item.component.d.ts +2 -0
- package/chips/lib/chips/chips/chips.component.d.ts +2 -1
- package/datepicker/README.md +15 -2
- package/datepicker/lib/datepicker/date-segment-input.d.ts +82 -0
- package/datepicker/lib/datepicker/date.utils.d.ts +3 -7
- package/datepicker/lib/datepicker/datepicker.component.d.ts +101 -8
- package/dynamic-form/dynamic-form/components/lookup/models/lookup-api.model.d.ts +7 -1
- package/dynamic-form/dynamic-form/form-field/configurations/fields/lookup-field.d.ts +1 -1
- package/dynamic-form/public-api.d.ts +1 -1
- package/esm2022/alert/lib/alert/alert.component.mjs +12 -6
- package/esm2022/chips/lib/chips/chip-item/chip-item.component.mjs +15 -4
- package/esm2022/chips/lib/chips/chips/chips.component.mjs +26 -14
- package/esm2022/datepicker/lib/datepicker/date-segment-input.mjs +418 -0
- package/esm2022/datepicker/lib/datepicker/date.utils.mjs +7 -79
- package/esm2022/datepicker/lib/datepicker/datepicker.component.mjs +451 -41
- package/esm2022/dynamic-form/dynamic-form/components/lookup/lookup.component.mjs +2 -2
- package/esm2022/dynamic-form/dynamic-form/components/lookup/models/lookup-api.model.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/lookup-field.mjs +1 -1
- package/esm2022/dynamic-form/public-api.mjs +1 -1
- package/esm2022/panel/lib/panel/panel.component.mjs +3 -3
- package/esm2022/sidebar/lib/sidebar/sidebar.component.mjs +8 -6
- package/esm2022/thumbnail/lib/thumbnail/thumbnail.component.mjs +3 -3
- package/fesm2022/seniorsistemas-angular-components-alert.mjs +12 -6
- package/fesm2022/seniorsistemas-angular-components-alert.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-chips.mjs +39 -16
- package/fesm2022/seniorsistemas-angular-components-chips.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-datepicker.mjs +873 -118
- package/fesm2022/seniorsistemas-angular-components-datepicker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-panel.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-panel.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-sidebar.mjs +7 -5
- package/fesm2022/seniorsistemas-angular-components-sidebar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-thumbnail.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-thumbnail.mjs.map +1 -1
- package/package.json +13 -13
- package/schematics/migrations/migrate-steps-to-stepper/index.d.ts +2 -0
- package/schematics/migrations/migrate-steps-to-stepper/index.js +104 -0
- package/schematics/migrations/migrate-steps-to-stepper/index.js.map +1 -0
- package/schematics/migrations.json +5 -0
- package/schematics/utils/ast-utils.d.ts +13 -0
- package/schematics/utils/ast-utils.js +76 -0
- package/schematics/utils/ast-utils.js.map +1 -1
- package/sidebar/lib/sidebar/sidebar.component.d.ts +3 -1
- package/schematics/migrations/migrate-dynamic-form-v19/index.test.d.ts +0 -1
- package/schematics/migrations/migrate-dynamic-form-v19/index.test.js +0 -888
- package/schematics/migrations/migrate-dynamic-form-v19/index.test.js.map +0 -1
- package/schematics/migrations/migrate-p-datepicker/index.test.d.ts +0 -1
- package/schematics/migrations/migrate-p-datepicker/index.test.js +0 -392
- package/schematics/migrations/migrate-p-datepicker/index.test.js.map +0 -1
- package/schematics/migrations/migrate-p-editor/index.test.d.ts +0 -1
- package/schematics/migrations/migrate-p-editor/index.test.js +0 -393
- package/schematics/migrations/migrate-p-editor/index.test.js.map +0 -1
- package/schematics/migrations/migrate-s-chips-outputs/index.test.d.ts +0 -1
- package/schematics/migrations/migrate-s-chips-outputs/index.test.js +0 -125
- package/schematics/migrations/migrate-s-chips-outputs/index.test.js.map +0 -1
- package/schematics/utils/ast-utils.test.d.ts +0 -1
- package/schematics/utils/ast-utils.test.js +0 -138
- package/schematics/utils/ast-utils.test.js.map +0 -1
- package/schematics/utils/workspace-utils.test.d.ts +0 -1
- package/schematics/utils/workspace-utils.test.js +0 -152
- package/schematics/utils/workspace-utils.test.js.map +0 -1
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const migrationsPath = path.join(__dirname, '../../migrations.json');
|
|
7
|
-
const runner = new testing_1.SchematicTestRunner('migrations', migrationsPath);
|
|
8
|
-
const MIGRATION = 'migration-v19-6-0-p-editor';
|
|
9
|
-
async function runMigration(files) {
|
|
10
|
-
const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
|
|
11
|
-
for (const [filePath, content] of Object.entries(files)) {
|
|
12
|
-
tree.create(filePath, content);
|
|
13
|
-
}
|
|
14
|
-
return runner.runSchematic(MIGRATION, {}, tree);
|
|
15
|
-
}
|
|
16
|
-
describe('migrate-p-editor', () => {
|
|
17
|
-
// ─── Detecção condicional ─────────────────────────────────────────────────
|
|
18
|
-
it('não deve modificar arquivos quando não há p-editor no projeto', async () => {
|
|
19
|
-
const content = `<div><p>Olá mundo</p></div>`;
|
|
20
|
-
const result = await runMigration({ 'app.component.html': content });
|
|
21
|
-
expect(result.readText('app.component.html')).toBe(content);
|
|
22
|
-
});
|
|
23
|
-
it('não deve modificar .ts sem EditorModule nem type editor', async () => {
|
|
24
|
-
const content = `import { Component } from '@angular/core';\n@Component({}) export class AppComponent {}`;
|
|
25
|
-
const result = await runMigration({ 'app.component.ts': content });
|
|
26
|
-
expect(result.readText('app.component.ts')).toBe(content);
|
|
27
|
-
});
|
|
28
|
-
// ─── Tag rename ───────────────────────────────────────────────────────────
|
|
29
|
-
it('deve renomear a tag de abertura <p-editor> para <s-editor>', async () => {
|
|
30
|
-
const result = await runMigration({
|
|
31
|
-
'app.component.html': `<p-editor [(ngModel)]="text"></p-editor>`,
|
|
32
|
-
});
|
|
33
|
-
expect(result.readText('app.component.html')).toContain('<s-editor');
|
|
34
|
-
expect(result.readText('app.component.html')).not.toContain('<p-editor');
|
|
35
|
-
});
|
|
36
|
-
it('deve renomear a tag de fechamento </p-editor> para </s-editor>', async () => {
|
|
37
|
-
const result = await runMigration({
|
|
38
|
-
'app.component.html': `<p-editor [(ngModel)]="text"></p-editor>`,
|
|
39
|
-
});
|
|
40
|
-
expect(result.readText('app.component.html')).toContain('</s-editor>');
|
|
41
|
-
expect(result.readText('app.component.html')).not.toContain('</p-editor>');
|
|
42
|
-
});
|
|
43
|
-
// ─── Atributos mantidos ───────────────────────────────────────────────────
|
|
44
|
-
it('deve manter [style]', async () => {
|
|
45
|
-
const result = await runMigration({
|
|
46
|
-
'app.component.html': `<p-editor [style]="{'height':'320px'}"></p-editor>`,
|
|
47
|
-
});
|
|
48
|
-
expect(result.readText('app.component.html')).toContain(`[style]="{'height':'320px'}"`);
|
|
49
|
-
});
|
|
50
|
-
it('deve manter [readonly]', async () => {
|
|
51
|
-
const result = await runMigration({
|
|
52
|
-
'app.component.html': `<p-editor [readonly]="true"></p-editor>`,
|
|
53
|
-
});
|
|
54
|
-
expect(result.readText('app.component.html')).toContain('[readonly]="true"');
|
|
55
|
-
});
|
|
56
|
-
it('deve manter placeholder', async () => {
|
|
57
|
-
const result = await runMigration({
|
|
58
|
-
'app.component.html': `<p-editor placeholder="Digite aqui"></p-editor>`,
|
|
59
|
-
});
|
|
60
|
-
expect(result.readText('app.component.html')).toContain('placeholder="Digite aqui"');
|
|
61
|
-
});
|
|
62
|
-
it('deve manter [formats]', async () => {
|
|
63
|
-
const result = await runMigration({
|
|
64
|
-
'app.component.html': `<p-editor [formats]="formats"></p-editor>`,
|
|
65
|
-
});
|
|
66
|
-
expect(result.readText('app.component.html')).toContain('[formats]="formats"');
|
|
67
|
-
});
|
|
68
|
-
// ─── Atributos removidos ──────────────────────────────────────────────────
|
|
69
|
-
it('deve remover [modules]', async () => {
|
|
70
|
-
const result = await runMigration({
|
|
71
|
-
'app.component.html': `<p-editor [modules]="quillModules"></p-editor>`,
|
|
72
|
-
});
|
|
73
|
-
expect(result.readText('app.component.html')).not.toContain('modules');
|
|
74
|
-
});
|
|
75
|
-
it('deve remover [bounds]', async () => {
|
|
76
|
-
const result = await runMigration({
|
|
77
|
-
'app.component.html': `<p-editor [bounds]="el"></p-editor>`,
|
|
78
|
-
});
|
|
79
|
-
expect(result.readText('app.component.html')).not.toContain('bounds');
|
|
80
|
-
});
|
|
81
|
-
it('deve remover [scrollingContainer]', async () => {
|
|
82
|
-
const result = await runMigration({
|
|
83
|
-
'app.component.html': `<p-editor [scrollingContainer]="container"></p-editor>`,
|
|
84
|
-
});
|
|
85
|
-
expect(result.readText('app.component.html')).not.toContain('scrollingContainer');
|
|
86
|
-
});
|
|
87
|
-
it('deve remover [debug]', async () => {
|
|
88
|
-
const result = await runMigration({
|
|
89
|
-
'app.component.html': `<p-editor [debug]="'warn'"></p-editor>`,
|
|
90
|
-
});
|
|
91
|
-
expect(result.readText('app.component.html')).not.toContain('debug');
|
|
92
|
-
});
|
|
93
|
-
// ─── Eventos renomeados ───────────────────────────────────────────────────
|
|
94
|
-
it('deve renomear (onTextChange) para (textChange)', async () => {
|
|
95
|
-
const result = await runMigration({
|
|
96
|
-
'app.component.html': `<p-editor (onTextChange)="onChange($event)"></p-editor>`,
|
|
97
|
-
});
|
|
98
|
-
expect(result.readText('app.component.html')).toContain('(textChange)="onChange($event)"');
|
|
99
|
-
expect(result.readText('app.component.html')).not.toContain('onTextChange');
|
|
100
|
-
});
|
|
101
|
-
it('deve renomear (onSelectionChange) para (selectionChange)', async () => {
|
|
102
|
-
const result = await runMigration({
|
|
103
|
-
'app.component.html': `<p-editor (onSelectionChange)="onSel($event)"></p-editor>`,
|
|
104
|
-
});
|
|
105
|
-
expect(result.readText('app.component.html')).toContain('(selectionChange)="onSel($event)"');
|
|
106
|
-
expect(result.readText('app.component.html')).not.toContain('onSelectionChange');
|
|
107
|
-
});
|
|
108
|
-
it('deve renomear (onInit) para (editorInit)', async () => {
|
|
109
|
-
const result = await runMigration({
|
|
110
|
-
'app.component.html': `<p-editor (onInit)="onInit($event)"></p-editor>`,
|
|
111
|
-
});
|
|
112
|
-
expect(result.readText('app.component.html')).toContain('(editorInit)="onInit($event)"');
|
|
113
|
-
expect(result.readText('app.component.html')).not.toContain('(onInit)');
|
|
114
|
-
});
|
|
115
|
-
// ─── Remoção de <p-header> ────────────────────────────────────────────────
|
|
116
|
-
it('deve remover bloco <p-header>...</p-header>', async () => {
|
|
117
|
-
const result = await runMigration({
|
|
118
|
-
'app.component.html': `
|
|
119
|
-
<p-editor [(ngModel)]="text" [style]="{'height':'320px'}">
|
|
120
|
-
<p-header>
|
|
121
|
-
<span class="ql-formats">
|
|
122
|
-
<button class="ql-bold"></button>
|
|
123
|
-
</span>
|
|
124
|
-
</p-header>
|
|
125
|
-
</p-editor>`,
|
|
126
|
-
});
|
|
127
|
-
const html = result.readText('app.component.html');
|
|
128
|
-
expect(html).not.toContain('<p-header>');
|
|
129
|
-
expect(html).not.toContain('</p-header>');
|
|
130
|
-
expect(html).not.toContain('ql-formats');
|
|
131
|
-
expect(html).toContain('<s-editor');
|
|
132
|
-
});
|
|
133
|
-
it('deve remover bloco ng-template com pTemplate="header"', async () => {
|
|
134
|
-
const result = await runMigration({
|
|
135
|
-
'app.component.html': `
|
|
136
|
-
<p-editor [(ngModel)]="text">
|
|
137
|
-
<ng-template pTemplate="header">
|
|
138
|
-
<button class="ql-bold"></button>
|
|
139
|
-
</ng-template>
|
|
140
|
-
</p-editor>`,
|
|
141
|
-
});
|
|
142
|
-
const html = result.readText('app.component.html');
|
|
143
|
-
expect(html).not.toContain('pTemplate="header"');
|
|
144
|
-
expect(html).not.toContain('ql-bold');
|
|
145
|
-
expect(html).toContain('<s-editor');
|
|
146
|
-
});
|
|
147
|
-
// ─── Template completo ────────────────────────────────────────────────────
|
|
148
|
-
it('deve migrar template completo com múltiplos atributos e eventos', async () => {
|
|
149
|
-
const result = await runMigration({
|
|
150
|
-
'app.component.html': `
|
|
151
|
-
<p-editor
|
|
152
|
-
[(ngModel)]="text"
|
|
153
|
-
[style]="{'height':'320px'}"
|
|
154
|
-
[readonly]="isReadonly"
|
|
155
|
-
[formats]="editorFormats"
|
|
156
|
-
[modules]="quillConfig"
|
|
157
|
-
(onTextChange)="onChange($event)"
|
|
158
|
-
(onSelectionChange)="onSel($event)"
|
|
159
|
-
(onInit)="onInit($event)"
|
|
160
|
-
></p-editor>`,
|
|
161
|
-
});
|
|
162
|
-
const html = result.readText('app.component.html');
|
|
163
|
-
expect(html).toContain('<s-editor');
|
|
164
|
-
expect(html).toContain('[style]="');
|
|
165
|
-
expect(html).toContain('[readonly]="isReadonly"');
|
|
166
|
-
expect(html).toContain('[formats]="editorFormats"');
|
|
167
|
-
expect(html).toContain('(textChange)="onChange($event)"');
|
|
168
|
-
expect(html).toContain('(selectionChange)="onSel($event)"');
|
|
169
|
-
expect(html).toContain('(editorInit)="onInit($event)"');
|
|
170
|
-
expect(html).not.toContain('p-editor');
|
|
171
|
-
expect(html).not.toContain('modules');
|
|
172
|
-
});
|
|
173
|
-
// ─── TypeScript: EditorModule → EditorComponent ───────────────────────────
|
|
174
|
-
it('deve remover import EditorModule do PrimeNG', async () => {
|
|
175
|
-
const result = await runMigration({
|
|
176
|
-
'app.component.ts': `import { EditorModule } from 'primeng/editor';\n@Component({}) export class AppComponent {}`,
|
|
177
|
-
});
|
|
178
|
-
expect(result.readText('app.component.ts')).not.toContain('EditorModule');
|
|
179
|
-
expect(result.readText('app.component.ts')).not.toContain("from 'primeng/editor'");
|
|
180
|
-
});
|
|
181
|
-
it('deve adicionar import EditorComponent do s-editor', async () => {
|
|
182
|
-
const result = await runMigration({
|
|
183
|
-
'app.component.ts': `import { EditorModule } from 'primeng/editor';\n@Component({}) export class AppComponent {}`,
|
|
184
|
-
});
|
|
185
|
-
const ts = result.readText('app.component.ts');
|
|
186
|
-
expect(ts).toContain('EditorComponent');
|
|
187
|
-
expect(ts).toContain('@seniorsistemas/angular-components/editor');
|
|
188
|
-
});
|
|
189
|
-
it('deve preservar outros imports do mesmo arquivo ao remover EditorModule', async () => {
|
|
190
|
-
const result = await runMigration({
|
|
191
|
-
'app.component.ts': `import { EditorModule } from 'primeng/editor';\nimport { CommonModule } from '@angular/common';\n@Component({}) export class AppComponent {}`,
|
|
192
|
-
});
|
|
193
|
-
const ts = result.readText('app.component.ts');
|
|
194
|
-
expect(ts).toContain('CommonModule');
|
|
195
|
-
expect(ts).not.toContain('EditorModule');
|
|
196
|
-
});
|
|
197
|
-
it('deve substituir EditorModule no array imports de @NgModule', async () => {
|
|
198
|
-
const result = await runMigration({
|
|
199
|
-
'app.module.ts': `import { EditorModule } from 'primeng/editor';\n@NgModule({ imports: [CommonModule, EditorModule] })\nexport class AppModule {}`,
|
|
200
|
-
});
|
|
201
|
-
const ts = result.readText('app.module.ts');
|
|
202
|
-
expect(ts).toContain('EditorComponent');
|
|
203
|
-
expect(ts).toContain('CommonModule');
|
|
204
|
-
expect(ts).not.toContain('EditorModule');
|
|
205
|
-
});
|
|
206
|
-
it('deve substituir EditorModule no array exports de @NgModule', async () => {
|
|
207
|
-
const result = await runMigration({
|
|
208
|
-
'app.module.ts': `import { EditorModule } from 'primeng/editor';\n@NgModule({ imports: [BrowserModule], exports: [EditorModule, DropdownModule] })\nexport class AppModule {}`,
|
|
209
|
-
});
|
|
210
|
-
const ts = result.readText('app.module.ts');
|
|
211
|
-
expect(ts).toContain('EditorComponent');
|
|
212
|
-
expect(ts).toContain('DropdownModule');
|
|
213
|
-
expect(ts).not.toContain('EditorModule');
|
|
214
|
-
});
|
|
215
|
-
it('deve substituir EditorModule no array imports de @Component standalone', async () => {
|
|
216
|
-
const result = await runMigration({
|
|
217
|
-
'app.component.ts': `import { EditorModule } from 'primeng/editor';\n@Component({ imports: [EditorModule], template: '' })\nexport class AppComponent {}`,
|
|
218
|
-
});
|
|
219
|
-
const ts = result.readText('app.component.ts');
|
|
220
|
-
expect(ts).toContain('EditorComponent');
|
|
221
|
-
expect(ts).not.toContain('EditorModule');
|
|
222
|
-
});
|
|
223
|
-
it('deve substituir EditorModule importado via re-export (sem import direto do primeng)', async () => {
|
|
224
|
-
const result = await runMigration({
|
|
225
|
-
'feature.module.ts': `import { NgModule } from '@angular/core';\nimport { EditorModule } from '../shared/primeng';\n\n@NgModule({ imports: [EditorModule] })\nexport class FeatureModule {}`,
|
|
226
|
-
});
|
|
227
|
-
const ts = result.readText('feature.module.ts');
|
|
228
|
-
expect(ts).not.toContain('EditorModule');
|
|
229
|
-
expect(ts).toContain('EditorComponent');
|
|
230
|
-
expect(ts).toContain('@seniorsistemas/angular-components/editor');
|
|
231
|
-
});
|
|
232
|
-
// ─── DynamicForm: remoção de modules ─────────────────────────────────────
|
|
233
|
-
it('deve remover propriedade modules de config { type: editor }', async () => {
|
|
234
|
-
const result = await runMigration({
|
|
235
|
-
'form.config.ts': `
|
|
236
|
-
const fields = [
|
|
237
|
-
{ type: 'editor', name: 'obs', modules: { toolbar: [['bold', 'italic']] } }
|
|
238
|
-
];`,
|
|
239
|
-
});
|
|
240
|
-
const ts = result.readText('form.config.ts');
|
|
241
|
-
expect(ts).not.toContain('modules');
|
|
242
|
-
expect(ts).toContain("type: 'editor'");
|
|
243
|
-
expect(ts).toContain("name: 'obs'");
|
|
244
|
-
});
|
|
245
|
-
it('deve remover modules quando é a última propriedade do objeto editor', async () => {
|
|
246
|
-
const result = await runMigration({
|
|
247
|
-
'form.config.ts': `const f = { type: 'editor', name: 'x', modules: {} };`,
|
|
248
|
-
});
|
|
249
|
-
const ts = result.readText('form.config.ts');
|
|
250
|
-
expect(ts).not.toContain('modules');
|
|
251
|
-
expect(ts).toContain("type: 'editor'");
|
|
252
|
-
expect(ts).toContain("name: 'x'");
|
|
253
|
-
});
|
|
254
|
-
it('deve remover modules quando é a única propriedade extra (além de type)', async () => {
|
|
255
|
-
const result = await runMigration({
|
|
256
|
-
'form.config.ts': `const f = { type: 'editor', modules: { toolbar: true } };`,
|
|
257
|
-
});
|
|
258
|
-
const ts = result.readText('form.config.ts');
|
|
259
|
-
expect(ts).not.toContain('modules');
|
|
260
|
-
});
|
|
261
|
-
it('não deve modificar objeto sem type editor ao ter propriedade modules', async () => {
|
|
262
|
-
const content = `const f = { type: 'text', name: 'x', modules: {} };`;
|
|
263
|
-
const result = await runMigration({
|
|
264
|
-
'form.config.ts': content,
|
|
265
|
-
});
|
|
266
|
-
expect(result.readText('form.config.ts')).toBe(content);
|
|
267
|
-
});
|
|
268
|
-
// ─── DynamicForm: migração de formats ────────────────────────────────────
|
|
269
|
-
it('deve remover formato Quill sem equivalente e manter os suportados', async () => {
|
|
270
|
-
const result = await runMigration({
|
|
271
|
-
'form.config.ts': `const f = { type: 'editor', formats: ['bold', 'background', 'italic'] };`,
|
|
272
|
-
});
|
|
273
|
-
const ts = result.readText('form.config.ts');
|
|
274
|
-
expect(ts).toContain("'bold'");
|
|
275
|
-
expect(ts).toContain("'italic'");
|
|
276
|
-
expect(ts).not.toContain("'background'");
|
|
277
|
-
});
|
|
278
|
-
it('deve mapear "bullet" para "list"', async () => {
|
|
279
|
-
const result = await runMigration({
|
|
280
|
-
'form.config.ts': `const f = { type: 'editor', formats: ['bullet', 'bold'] };`,
|
|
281
|
-
});
|
|
282
|
-
const ts = result.readText('form.config.ts');
|
|
283
|
-
expect(ts).toContain("'list'");
|
|
284
|
-
expect(ts).not.toContain("'bullet'");
|
|
285
|
-
expect(ts).toContain("'bold'");
|
|
286
|
-
});
|
|
287
|
-
it('deve deduplicar quando "bullet" e "list" estão ambos presentes', async () => {
|
|
288
|
-
const result = await runMigration({
|
|
289
|
-
'form.config.ts': `const f = { type: 'editor', formats: ['list', 'bullet', 'bold'] };`,
|
|
290
|
-
});
|
|
291
|
-
const ts = result.readText('form.config.ts');
|
|
292
|
-
const matches = ts.match(/'list'/g) ?? [];
|
|
293
|
-
expect(matches.length).toBe(1);
|
|
294
|
-
expect(ts).not.toContain("'bullet'");
|
|
295
|
-
});
|
|
296
|
-
it('deve remover todos os formatos não suportados', async () => {
|
|
297
|
-
const result = await runMigration({
|
|
298
|
-
'form.config.ts': `const f = { type: 'editor', formats: ['background', 'font', 'size', 'script'] };`,
|
|
299
|
-
});
|
|
300
|
-
const ts = result.readText('form.config.ts');
|
|
301
|
-
expect(ts).toContain('formats: []');
|
|
302
|
-
});
|
|
303
|
-
it('não deve modificar formats com apenas valores suportados', async () => {
|
|
304
|
-
const content = `const f = { type: 'editor', name: 'x', formats: ['bold', 'italic'] };`;
|
|
305
|
-
const result = await runMigration({ 'form.config.ts': content });
|
|
306
|
-
expect(result.readText('form.config.ts')).toBe(content);
|
|
307
|
-
});
|
|
308
|
-
it('deve manter os formats corretos após remoção: bold, italic, underline, link', async () => {
|
|
309
|
-
const result = await runMigration({
|
|
310
|
-
'form.config.ts': `const f = { type: 'editor', formats: ['bold', 'italic', 'underline', 'link', 'video'] };`,
|
|
311
|
-
});
|
|
312
|
-
const ts = result.readText('form.config.ts');
|
|
313
|
-
expect(ts).toContain("'bold'");
|
|
314
|
-
expect(ts).toContain("'italic'");
|
|
315
|
-
expect(ts).toContain("'underline'");
|
|
316
|
-
expect(ts).toContain("'link'");
|
|
317
|
-
expect(ts).not.toContain("'video'");
|
|
318
|
-
});
|
|
319
|
-
// ─── DynamicForm: modules + formats juntos ────────────────────────────────
|
|
320
|
-
it('deve remover modules e migrar formats no mesmo objeto', async () => {
|
|
321
|
-
const result = await runMigration({
|
|
322
|
-
'form.config.ts': `
|
|
323
|
-
const fields = [
|
|
324
|
-
{ type: 'editor', name: 'obs', formats: ['bold', 'background'], modules: { toolbar: true } }
|
|
325
|
-
];`,
|
|
326
|
-
});
|
|
327
|
-
const ts = result.readText('form.config.ts');
|
|
328
|
-
expect(ts).not.toContain('modules');
|
|
329
|
-
expect(ts).not.toContain("'background'");
|
|
330
|
-
expect(ts).toContain("'bold'");
|
|
331
|
-
});
|
|
332
|
-
// ─── package.json ─────────────────────────────────────────────────────────
|
|
333
|
-
it('deve remover quill de dependencies e adicionar @tiptap/*', async () => {
|
|
334
|
-
const result = await runMigration({
|
|
335
|
-
'app.component.html': `<p-editor></p-editor>`,
|
|
336
|
-
'/package.json': JSON.stringify({
|
|
337
|
-
dependencies: { quill: '^2.0.0', 'primeng': '^18.0.0' },
|
|
338
|
-
}),
|
|
339
|
-
});
|
|
340
|
-
const pkg = JSON.parse(result.readText('/package.json'));
|
|
341
|
-
expect(pkg.dependencies['quill']).toBeUndefined();
|
|
342
|
-
expect(pkg.dependencies['@tiptap/core']).toBeDefined();
|
|
343
|
-
expect(pkg.dependencies['@tiptap/starter-kit']).toBeDefined();
|
|
344
|
-
expect(pkg.dependencies['@tiptap/extension-color']).toBeDefined();
|
|
345
|
-
});
|
|
346
|
-
it('deve remover quill de devDependencies', async () => {
|
|
347
|
-
const result = await runMigration({
|
|
348
|
-
'app.component.html': `<p-editor></p-editor>`,
|
|
349
|
-
'/package.json': JSON.stringify({
|
|
350
|
-
devDependencies: { quill: '^2.0.0' },
|
|
351
|
-
}),
|
|
352
|
-
});
|
|
353
|
-
const pkg = JSON.parse(result.readText('/package.json'));
|
|
354
|
-
expect(pkg.devDependencies['quill']).toBeUndefined();
|
|
355
|
-
});
|
|
356
|
-
it('não deve duplicar @tiptap/* já presentes no package.json', async () => {
|
|
357
|
-
const result = await runMigration({
|
|
358
|
-
'app.component.html': `<p-editor></p-editor>`,
|
|
359
|
-
'/package.json': JSON.stringify({
|
|
360
|
-
dependencies: { '@tiptap/core': '^3.27.0' },
|
|
361
|
-
}),
|
|
362
|
-
});
|
|
363
|
-
const pkg = JSON.parse(result.readText('/package.json'));
|
|
364
|
-
const coreEntries = Object.keys(pkg.dependencies).filter((k) => k === '@tiptap/core');
|
|
365
|
-
expect(coreEntries.length).toBe(1);
|
|
366
|
-
expect(pkg.dependencies['@tiptap/core']).toBe('^3.27.0');
|
|
367
|
-
});
|
|
368
|
-
it('deve adicionar todos os 12 pacotes @tiptap/*', async () => {
|
|
369
|
-
const result = await runMigration({
|
|
370
|
-
'app.component.html': `<p-editor></p-editor>`,
|
|
371
|
-
'/package.json': JSON.stringify({ dependencies: {} }),
|
|
372
|
-
});
|
|
373
|
-
const pkg = JSON.parse(result.readText('/package.json'));
|
|
374
|
-
const expected = [
|
|
375
|
-
'@tiptap/core',
|
|
376
|
-
'@tiptap/extension-color',
|
|
377
|
-
'@tiptap/extension-highlight',
|
|
378
|
-
'@tiptap/extension-image',
|
|
379
|
-
'@tiptap/extension-placeholder',
|
|
380
|
-
'@tiptap/extension-subscript',
|
|
381
|
-
'@tiptap/extension-superscript',
|
|
382
|
-
'@tiptap/extension-text-align',
|
|
383
|
-
'@tiptap/extension-text-style',
|
|
384
|
-
'@tiptap/extension-underline',
|
|
385
|
-
'@tiptap/pm',
|
|
386
|
-
'@tiptap/starter-kit',
|
|
387
|
-
];
|
|
388
|
-
for (const name of expected) {
|
|
389
|
-
expect(pkg.dependencies[name]).toBeDefined(`${name} deve estar em dependencies`);
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../projects/angular-components/schematics/migrations/migrate-p-editor/index.test.ts"],"names":[],"mappings":";;AAAA,gEAAuF;AACvF,2DAAkD;AAClD,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACrE,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AACrE,M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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const migrationsPath = path.join(__dirname, '../../migrations.json');
|
|
7
|
-
const runner = new testing_1.SchematicTestRunner('migrations', migrationsPath);
|
|
8
|
-
const MIGRATION = 'migration-v19-6-2-s-chips-outputs';
|
|
9
|
-
async function runMigration(files) {
|
|
10
|
-
const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
|
|
11
|
-
for (const [filePath, content] of Object.entries(files)) {
|
|
12
|
-
tree.create(filePath, content);
|
|
13
|
-
}
|
|
14
|
-
return runner.runSchematic(MIGRATION, {}, tree);
|
|
15
|
-
}
|
|
16
|
-
describe('migrate-s-chips-outputs', () => {
|
|
17
|
-
// ─── Renames individuais ─────────────────────────────────────────────────
|
|
18
|
-
it('deve renomear (onAdd) para (added)', async () => {
|
|
19
|
-
const result = await runMigration({
|
|
20
|
-
'app.component.html': `<s-chips (onAdd)="onAdd($event)" />`,
|
|
21
|
-
});
|
|
22
|
-
expect(result.readText('app.component.html')).toContain('(added)="onAdd($event)"');
|
|
23
|
-
expect(result.readText('app.component.html')).not.toContain('(onAdd)');
|
|
24
|
-
});
|
|
25
|
-
it('deve renomear (onRemove) para (removed)', async () => {
|
|
26
|
-
const result = await runMigration({
|
|
27
|
-
'app.component.html': `<s-chips (onRemove)="onRemove($event)" />`,
|
|
28
|
-
});
|
|
29
|
-
expect(result.readText('app.component.html')).toContain('(removed)="onRemove($event)"');
|
|
30
|
-
expect(result.readText('app.component.html')).not.toContain('(onRemove)');
|
|
31
|
-
});
|
|
32
|
-
it('deve renomear (onChipClick) para (chipClicked)', async () => {
|
|
33
|
-
const result = await runMigration({
|
|
34
|
-
'app.component.html': `<s-chips (onChipClick)="onChipClick($event)" />`,
|
|
35
|
-
});
|
|
36
|
-
expect(result.readText('app.component.html')).toContain('(chipClicked)="onChipClick($event)"');
|
|
37
|
-
expect(result.readText('app.component.html')).not.toContain('(onChipClick)');
|
|
38
|
-
});
|
|
39
|
-
it('deve renomear (onFocus) para (focused) dentro de s-chips', async () => {
|
|
40
|
-
const result = await runMigration({
|
|
41
|
-
'app.component.html': `<s-chips (onFocus)="onFocus($event)" />`,
|
|
42
|
-
});
|
|
43
|
-
expect(result.readText('app.component.html')).toContain('(focused)="onFocus($event)"');
|
|
44
|
-
expect(result.readText('app.component.html')).not.toContain('(onFocus)');
|
|
45
|
-
});
|
|
46
|
-
it('deve renomear (onBlur) para (focusLost) dentro de s-chips', async () => {
|
|
47
|
-
const result = await runMigration({
|
|
48
|
-
'app.component.html': `<s-chips (onBlur)="onBlur($event)" />`,
|
|
49
|
-
});
|
|
50
|
-
expect(result.readText('app.component.html')).toContain('(focusLost)="onBlur($event)"');
|
|
51
|
-
expect(result.readText('app.component.html')).not.toContain('(onBlur)');
|
|
52
|
-
});
|
|
53
|
-
// ─── Escopo dos eventos genéricos ────────────────────────────────────────
|
|
54
|
-
it('não deve alterar (onFocus) em elementos que não são s-chips', async () => {
|
|
55
|
-
const result = await runMigration({
|
|
56
|
-
'app.component.html': `<s-chips [value]="tags" />\n<input (onFocus)="focus()" />`,
|
|
57
|
-
});
|
|
58
|
-
expect(result.readText('app.component.html')).toContain('(onFocus)="focus()"');
|
|
59
|
-
});
|
|
60
|
-
it('não deve alterar (onBlur) em elementos que não são s-chips', async () => {
|
|
61
|
-
const result = await runMigration({
|
|
62
|
-
'app.component.html': `<s-chips [value]="tags" />\n<input (onBlur)="blur()" />`,
|
|
63
|
-
});
|
|
64
|
-
expect(result.readText('app.component.html')).toContain('(onBlur)="blur()"');
|
|
65
|
-
});
|
|
66
|
-
// ─── Tag multi-linha ─────────────────────────────────────────────────────
|
|
67
|
-
it('deve renomear outputs em tag s-chips multi-linha', async () => {
|
|
68
|
-
const result = await runMigration({
|
|
69
|
-
'app.component.html': `
|
|
70
|
-
<s-chips
|
|
71
|
-
[value]="chips"
|
|
72
|
-
(onAdd)="onAdd($event)"
|
|
73
|
-
(onFocus)="onFocus($event)"
|
|
74
|
-
(onBlur)="onBlur($event)"
|
|
75
|
-
/>`,
|
|
76
|
-
});
|
|
77
|
-
const html = result.readText('app.component.html');
|
|
78
|
-
expect(html).toContain('(added)="onAdd($event)"');
|
|
79
|
-
expect(html).toContain('(focused)="onFocus($event)"');
|
|
80
|
-
expect(html).toContain('(focusLost)="onBlur($event)"');
|
|
81
|
-
expect(html).not.toContain('(onAdd)');
|
|
82
|
-
expect(html).not.toContain('(onFocus)');
|
|
83
|
-
expect(html).not.toContain('(onBlur)');
|
|
84
|
-
});
|
|
85
|
-
// ─── Template completo ───────────────────────────────────────────────────
|
|
86
|
-
it('deve migrar um template completo com todos os outputs legados', async () => {
|
|
87
|
-
const result = await runMigration({
|
|
88
|
-
'app.component.html': `
|
|
89
|
-
<s-chips
|
|
90
|
-
[value]="chips"
|
|
91
|
-
[allowDuplicated]="false"
|
|
92
|
-
[addOnTab]="true"
|
|
93
|
-
[addOnBlur]="true"
|
|
94
|
-
(onAdd)="onAdd($event)"
|
|
95
|
-
(onRemove)="onRemove($event)"
|
|
96
|
-
(onChipClick)="onChipClick($event)"
|
|
97
|
-
(onFocus)="onFocus($event)"
|
|
98
|
-
(onBlur)="onBlur($event)"
|
|
99
|
-
/>`,
|
|
100
|
-
});
|
|
101
|
-
const html = result.readText('app.component.html');
|
|
102
|
-
expect(html).toContain('(added)="onAdd($event)"');
|
|
103
|
-
expect(html).toContain('(removed)="onRemove($event)"');
|
|
104
|
-
expect(html).toContain('(chipClicked)="onChipClick($event)"');
|
|
105
|
-
expect(html).toContain('(focused)="onFocus($event)"');
|
|
106
|
-
expect(html).toContain('(focusLost)="onBlur($event)"');
|
|
107
|
-
expect(html).not.toContain('(onAdd)');
|
|
108
|
-
expect(html).not.toContain('(onRemove)');
|
|
109
|
-
expect(html).not.toContain('(onChipClick)');
|
|
110
|
-
expect(html).not.toContain('(onFocus)');
|
|
111
|
-
expect(html).not.toContain('(onBlur)');
|
|
112
|
-
});
|
|
113
|
-
// ─── Sem s-chips ─────────────────────────────────────────────────────────
|
|
114
|
-
it('não deve modificar arquivo sem s-chips', async () => {
|
|
115
|
-
const content = `<div class="container"><p>Olá</p></div>`;
|
|
116
|
-
const result = await runMigration({ 'app.component.html': content });
|
|
117
|
-
expect(result.readText('app.component.html')).toBe(content);
|
|
118
|
-
});
|
|
119
|
-
it('não deve modificar arquivo .ts', async () => {
|
|
120
|
-
const content = `import { Component } from '@angular/core';\n@Component({}) export class AppComponent {}`;
|
|
121
|
-
const result = await runMigration({ 'app.component.ts': content });
|
|
122
|
-
expect(result.readText('app.component.ts')).toBe(content);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../projects/angular-components/schematics/migrations/migrate-s-chips-outputs/index.test.ts"],"names":[],"mappings":";;AAAA,gEAAuF;AACvF,2DAAkD;AAClD,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACrE,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AACrE,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAEtD,KAAK,UAAU,YAAY,CAAC,KAA6B;IACrD,MAAM,IAAI,GAAG,IAAI,sBAAY,CAAC,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,OA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