@taiga-ui/cdk 3.45.0 → 3.46.0-canary.0ec50ee

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.
Files changed (79) hide show
  1. package/bundles/taiga-ui-cdk-constants.umd.js +1 -1
  2. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-directives-active-zone.umd.js +8 -15
  4. package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-tokens.umd.js +6 -0
  6. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  7. package/constants/version.d.ts +1 -1
  8. package/constants/version.js +1 -1
  9. package/esm2015/constants/version.js +2 -2
  10. package/esm2015/directives/active-zone/active-zone.directive.js +9 -16
  11. package/esm2015/tokens/base-href.js +5 -0
  12. package/esm2015/tokens/ensure-base-href.js +4 -1
  13. package/esm2015/tokens/index.js +2 -1
  14. package/fesm2015/taiga-ui-cdk-constants.js +1 -1
  15. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  16. package/fesm2015/taiga-ui-cdk-directives-active-zone.js +8 -15
  17. package/fesm2015/taiga-ui-cdk-directives-active-zone.js.map +1 -1
  18. package/fesm2015/taiga-ui-cdk-tokens.js +6 -1
  19. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  20. package/package.json +4 -4
  21. package/tokens/base-href.d.ts +1 -0
  22. package/tokens/ensure-base-href.d.ts +3 -0
  23. package/tokens/index.d.ts +1 -0
  24. package/schematics/ng-add/tests/schematic-ng-add-standalone.spec.d.ts +0 -1
  25. package/schematics/ng-add/tests/schematic-ng-add-standalone.spec.js +0 -381
  26. package/schematics/ng-add/tests/schematic-ng-add.spec.d.ts +0 -1
  27. package/schematics/ng-add/tests/schematic-ng-add.spec.js +0 -270
  28. package/schematics/ng-update/v3/tests/schematic-date-time.spec.d.ts +0 -1
  29. package/schematics/ng-update/v3/tests/schematic-date-time.spec.js +0 -117
  30. package/schematics/ng-update/v3/tests/schematic-migrate-hints.spec.d.ts +0 -1
  31. package/schematics/ng-update/v3/tests/schematic-migrate-hints.spec.js +0 -102
  32. package/schematics/ng-update/v3/tests/schematic-migrate-polymorpheus.spec.d.ts +0 -1
  33. package/schematics/ng-update/v3/tests/schematic-migrate-polymorpheus.spec.js +0 -107
  34. package/schematics/ng-update/v3/tests/schematic-migrate-progress.spec.d.ts +0 -1
  35. package/schematics/ng-update/v3/tests/schematic-migrate-progress.spec.js +0 -113
  36. package/schematics/ng-update/v3/tests/schematic-migrate-sliders.spec.d.ts +0 -1
  37. package/schematics/ng-update/v3/tests/schematic-migrate-sliders.spec.js +0 -380
  38. package/schematics/ng-update/v3/tests/schematic-migrate-tds.spec.d.ts +0 -1
  39. package/schematics/ng-update/v3/tests/schematic-migrate-tds.spec.js +0 -119
  40. package/schematics/ng-update/v3/tests/schematic-migrate-textfields.spec.d.ts +0 -1
  41. package/schematics/ng-update/v3/tests/schematic-migrate-textfields.spec.js +0 -123
  42. package/schematics/ng-update/v3/tests/schematic-miscellaneous.spec.d.ts +0 -1
  43. package/schematics/ng-update/v3/tests/schematic-miscellaneous.spec.js +0 -81
  44. package/schematics/ng-update/v3/tests/schematic-rename-types.spec.d.ts +0 -1
  45. package/schematics/ng-update/v3/tests/schematic-rename-types.spec.js +0 -157
  46. package/schematics/ng-update/v3/tests/schematic-replace-consts.spec.d.ts +0 -1
  47. package/schematics/ng-update/v3/tests/schematic-replace-consts.spec.js +0 -135
  48. package/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.d.ts +0 -1
  49. package/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.js +0 -53
  50. package/schematics/ng-update/v3/tests/schematic-replace-deprecated-functions.spec.d.ts +0 -1
  51. package/schematics/ng-update/v3/tests/schematic-replace-deprecated-functions.spec.js +0 -835
  52. package/schematics/ng-update/v3/tests/schematic-replace-enums.spec.d.ts +0 -1
  53. package/schematics/ng-update/v3/tests/schematic-replace-enums.spec.js +0 -68
  54. package/schematics/ng-update/v3/tests/schematic-replace-functions.spec.d.ts +0 -1
  55. package/schematics/ng-update/v3/tests/schematic-replace-functions.spec.js +0 -195
  56. package/schematics/ng-update/v3/tests/schematic-replace-html.spec.d.ts +0 -1
  57. package/schematics/ng-update/v3/tests/schematic-replace-html.spec.js +0 -611
  58. package/schematics/ng-update/v3/tests/schematic-replace-proprietary-consts.spec.d.ts +0 -1
  59. package/schematics/ng-update/v3/tests/schematic-replace-proprietary-consts.spec.js +0 -100
  60. package/schematics/ng-update/v3/tests/schematic-replace-services.spec.d.ts +0 -1
  61. package/schematics/ng-update/v3/tests/schematic-replace-services.spec.js +0 -102
  62. package/schematics/ng-update/v3/tests/schematic-replace-styles.spec.d.ts +0 -1
  63. package/schematics/ng-update/v3/tests/schematic-replace-styles.spec.js +0 -286
  64. package/schematics/ng-update/v3/tests/schematic-textfield-icon.spec.d.ts +0 -1
  65. package/schematics/ng-update/v3/tests/schematic-textfield-icon.spec.js +0 -141
  66. package/schematics/ng-update/v3/tests/schematic-warnings.spec.d.ts +0 -1
  67. package/schematics/ng-update/v3/tests/schematic-warnings.spec.js +0 -104
  68. package/schematics/ng-update/v3-30/tests/schematic-migrate-icons.spec.d.ts +0 -1
  69. package/schematics/ng-update/v3-30/tests/schematic-migrate-icons.spec.js +0 -87
  70. package/schematics/ng-update/v3-35/tests/schematic-migrate-icons.spec.d.ts +0 -1
  71. package/schematics/ng-update/v3-35/tests/schematic-migrate-icons.spec.js +0 -101
  72. package/schematics/ng-update/v3-36/tests/schematic-migrate-editor.spec.d.ts +0 -1
  73. package/schematics/ng-update/v3-36/tests/schematic-migrate-editor.spec.js +0 -117
  74. package/schematics/ng-update/v3-40/tests/schematic-migrate-textarea.spec.d.ts +0 -1
  75. package/schematics/ng-update/v3-40/tests/schematic-migrate-textarea.spec.js +0 -90
  76. package/schematics/ng-update/v3-5/tests/schematic-migrate-templates.spec.d.ts +0 -1
  77. package/schematics/ng-update/v3-5/tests/schematic-migrate-templates.spec.js +0 -74
  78. package/schematics/ng-update/v4/tests/schematic-migrate-thumbnail-card.spec.d.ts +0 -1
  79. package/schematics/ng-update/v4/tests/schematic-migrate-thumbnail-card.spec.js +0 -72
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /* eslint-disable rxjs/no-topromise */
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const testing_1 = require("@angular-devkit/schematics/testing");
7
- const ng_morph_1 = require("ng-morph");
8
- const path_1 = require("path");
9
- const create_angular_json_1 = require("../../../utils/create-angular-json");
10
- const migrate_progress_1 = require("../steps/migrate-progress");
11
- const collectionPath = path_1.join(__dirname, `../../../migration.json`);
12
- const APP_COMPONENT = `
13
- @Component({templateUrl: './app.template.html'})
14
- export class AppComponent {
15
- readonly complexGradient = 'linear-gradient(to right, var(--tui-support-02), var(--tui-support-14), var(--tui-support-12))';
16
- }
17
- `;
18
- const TEMPLATE_BEFORE = `
19
- <progress
20
- tuiProgressBar
21
- class="progress"
22
- [value]="slowValue$ | async"
23
- [max]="colors.length"
24
- [color]="colors | tuiProgressColorSegments"
25
- ></progress>
26
-
27
- <progress tuiProgressBar [max]="100" [value]="40" [color]="colors | tuiProgressColorSegmentsAsync | async"></progress>
28
-
29
- <progress
30
- tuiProgressBar
31
- max="100"
32
- [color]="complexGradient"
33
- [value]="fastValue$ | async"
34
- ></progress>
35
-
36
- <progress
37
- tuiProgressBar
38
- [tuiProgressColorSegments]="colors"
39
- [value]="fastValue$ | async"
40
- ></progress>
41
- `;
42
- const TEMPLATE_AFTER = `
43
- <progress
44
- tuiProgressBar
45
- class="progress"
46
- [value]="slowValue$ | async"
47
- [max]="colors.length"
48
- [tuiProgressColorSegments]="colors"
49
- ></progress>
50
-
51
- <progress tuiProgressBar [max]="100" [value]="40" [tuiProgressColorSegments]="colors"></progress>
52
-
53
- <progress
54
- tuiProgressBar
55
- max="100"
56
- [color]="complexGradient"
57
- [value]="fastValue$ | async"
58
- ></progress>
59
-
60
- <progress
61
- tuiProgressBar
62
- [tuiProgressColorSegments]="colors"
63
- [value]="fastValue$ | async"
64
- ></progress>
65
- `;
66
- describe(`migrate progress`, () => {
67
- let host;
68
- let runner;
69
- beforeEach(() => {
70
- host = new testing_1.UnitTestTree(new schematics_1.HostTree());
71
- runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
72
- ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
73
- createMainFiles();
74
- ng_morph_1.saveActiveProject();
75
- });
76
- describe(`migration works`, () => {
77
- it(`html`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
78
- const tree = yield runner
79
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
80
- .toPromise();
81
- expect(tree.readContent(`test/app-with-progress/app.template.html`)).toBe(TEMPLATE_AFTER);
82
- }));
83
- });
84
- describe(`DEPRECATED_PROGRESS_PIPES_REG`, () => {
85
- it(`colors | tuiProgressColorSegments`, () => {
86
- expect(`[tuiProgressColorSegments]="colors | tuiProgressColorSegments"`.replace(migrate_progress_1.DEPRECATED_PROGRESS_PIPES_REG, ``)).toBe(`[tuiProgressColorSegments]="colors"`);
87
- });
88
- it(`colors|tuiProgressColorSegments`, () => {
89
- expect(`[tuiProgressColorSegments]="colors|tuiProgressColorSegments"`.replace(migrate_progress_1.DEPRECATED_PROGRESS_PIPES_REG, ``)).toBe(`[tuiProgressColorSegments]="colors"`);
90
- });
91
- it(`colors | tuiProgressColorSegments | customPipe`, () => {
92
- expect(`[tuiProgressColorSegments]="colors | customPipe | tuiProgressColorSegments"`.replace(migrate_progress_1.DEPRECATED_PROGRESS_PIPES_REG, ``)).toBe(`[tuiProgressColorSegments]="colors | customPipe"`);
93
- });
94
- it(`colors | tuiProgressColorSegmentsAsync | async`, () => {
95
- expect(`[tuiProgressColorSegments]="colors | tuiProgressColorSegmentsAsync | async"`.replace(migrate_progress_1.DEPRECATED_PROGRESS_PIPES_REG, ``)).toBe(`[tuiProgressColorSegments]="colors"`);
96
- });
97
- it(`colors|tuiProgressColorSegmentsAsync|async`, () => {
98
- expect(`[tuiProgressColorSegments]="colors | tuiProgressColorSegmentsAsync | async"`.replace(migrate_progress_1.DEPRECATED_PROGRESS_PIPES_REG, ``)).toBe(`[tuiProgressColorSegments]="colors"`);
99
- });
100
- it(`colors | customPipe | tuiProgressColorSegmentsAsync | async`, () => {
101
- expect(`[tuiProgressColorSegments]="colors | customPipe | tuiProgressColorSegmentsAsync | async"`.replace(migrate_progress_1.DEPRECATED_PROGRESS_PIPES_REG, ``)).toBe(`[tuiProgressColorSegments]="colors | customPipe"`);
102
- });
103
- });
104
- afterEach(() => {
105
- ng_morph_1.resetActiveProject();
106
- });
107
- });
108
- function createMainFiles() {
109
- ng_morph_1.createSourceFile(`test/app-with-progress/app.component.ts`, APP_COMPONENT);
110
- ng_morph_1.createSourceFile(`test/app-with-progress/app.template.html`, TEMPLATE_BEFORE);
111
- create_angular_json_1.createAngularJson();
112
- ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
113
- }
@@ -1,380 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /* eslint-disable rxjs/no-topromise */
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const testing_1 = require("@angular-devkit/schematics/testing");
7
- const ng_morph_1 = require("ng-morph");
8
- const path_1 = require("path");
9
- const create_angular_json_1 = require("../../../utils/create-angular-json");
10
- const collectionPath = path_1.join(__dirname, `../../../migration.json`);
11
- const APP_MODULE = `
12
- import {CommonModule} from '@angular/common';
13
- import {NgModule} from '@angular/core';
14
- import {FormsModule} from '@angular/forms';
15
- import {TuiSliderModule} from '@taiga-ui/kit';
16
- import {AppComponent} from './app.component';
17
-
18
- @NgModule({
19
- imports: [
20
- CommonModule,
21
- FormsModule,
22
- TuiSliderModule
23
- ],
24
- declarations: [AppComponent],
25
- })
26
- export class AppModule {}
27
- `;
28
- const APP_COMPONENT = `
29
- @Component({templateUrl: './app.template.html'})
30
- export class AppComponent {
31
- value = 4;
32
- }
33
- `;
34
- const APP_TEMPLATE = `
35
- <h1>Title</h1>
36
- <inline-html-child></inline-html-child>
37
-
38
- <tui-input-slider [max]="100" [(ngModel)]="value" [min]="0" valueContent="TOP SECRET">
39
- Usage of the component without deprecated props
40
- </tui-input-slider>
41
-
42
- <tui-input-range
43
- [min]="0"
44
- [max]="100"
45
- [leftValueContent]="valueContent"
46
- [rightValueContent]="valueContent"
47
- [formControl]="control"
48
- >
49
- Desired departure day
50
- </tui-input-range>
51
-
52
- <file-html-child></file-html-child>
53
- <footer>123</footer>
54
- `;
55
- /** ___test/file-html-child/*___ */
56
- const FILE_HTML_CHILD_COMPONENT_BEFORE = `
57
- @Component({
58
- selector: 'file-html-child',
59
- templateUrl: './file-html-child.template.html'
60
- })
61
- export class FileHtmlChildComponent {}
62
- `;
63
- const FILE_HTML_CHILD_COMPONENT_AFTER = `import { TuiContextWithImplicit } from "@taiga-ui/cdk";
64
-
65
- @Component({
66
- selector: 'file-html-child',
67
- templateUrl: './file-html-child.template.html'
68
- })
69
- export class FileHtmlChildComponent {
70
- tuiMigrationMinMaxLabel(context: TuiContextWithImplicit<number>): string {
71
- const currentValue = context.$implicit;
72
- const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input
73
- const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label
74
- const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input
75
- const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label
76
- if (currentValue === maxValue) return maxLabelText;
77
- if (currentValue === minValue) return minLabelText;
78
- return String(currentValue);
79
- }
80
-
81
- tuiMigrationInputRangeMinLabel(context: TuiContextWithImplicit<number>): string {
82
- const currentValue = context.$implicit;
83
- const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range
84
- const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label
85
- if (currentValue === minValue) return minLabelText;
86
- return String(currentValue);
87
- }
88
-
89
- tuiMigrationInputRangeMaxLabel(context: TuiContextWithImplicit<number>): string {
90
- const currentValue = context.$implicit;
91
- const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input
92
- const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label
93
- if (currentValue === maxValue) return maxLabelText;
94
- return String(currentValue);
95
- }
96
- }
97
- `;
98
- const FILE_HTML_CHILD_TEMPLATE_BEFORE = `
99
- <tui-input-slider
100
- tuiHintContent="Select the answer to see how the right custom content changes"
101
- maxLabel="MAX(string property)"
102
- minLabel="MIN(string property)"
103
- class="control"
104
- [min]="0"
105
- [max]="10"
106
- [secondary]="userAnswer === 4 ? 'right' : 'wrong'"
107
- [pluralize]="pluralForms"
108
- [segmentsPluralize]="pluralForms"
109
- [(ngModel)]="userAnswer"
110
- >
111
- 2+2=?
112
- </tui-input-slider>
113
-
114
- <tui-input-range
115
- new
116
- [min]="0"
117
- [max]="100"
118
- [segments]="5"
119
- [steps]="5"
120
- [size]="size"
121
- [maxLabel]="Maxxxxx"
122
- minLabel="min!!!"
123
- [formControl]="control"
124
- [segmentsPluralize]="someVariable"
125
- >
126
- Select volume range
127
- </tui-input-range>
128
-
129
- <tui-slider [min]="100" [max]="1000" size="m" [segments]="5" [quantum]="0.01"></tui-slider>
130
- `;
131
- const FILE_HTML_CHILD_TEMPLATE_AFTER = `
132
- <!-- TODO: (Taiga UI migration) [pluralize] => Use [postfix] instead. See https://taiga-ui.dev/components/input-slider/API?postfix=apples -->
133
- <!-- TODO: (Taiga UI migration) See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-slider#slider-segments -->
134
- <tui-input-slider
135
- tuiHintContent="Select the answer to see how the right custom content changes"
136
- [valueContent]="tuiMigrationMinMaxLabel"
137
- ${``}
138
- class="control"
139
- [min]="0"
140
- [max]="10"
141
- [tuiTextfieldCustomContent]="userAnswer === 4 ? 'right' : 'wrong'"
142
- [pluralize]="pluralForms"
143
- [segmentsPluralize]="pluralForms"
144
- [(ngModel)]="userAnswer"
145
- >
146
- 2+2=?
147
- </tui-input-slider>
148
-
149
- <!-- TODO: (Taiga UI migration) See examples how create labels for ticks without this property (outside the component): https://taiga-ui.dev/components/input-range#segments -->
150
- <tui-input-range
151
- ${``}
152
- [min]="0"
153
- [max]="100"
154
- [segments]="5"
155
- [steps]="5"
156
- [tuiTextfieldSize]="size"
157
- [rightValueContent]="tuiMigrationInputRangeMaxLabel"
158
- [leftValueContent]="tuiMigrationInputRangeMinLabel"
159
- [formControl]="control"
160
- [segmentsPluralize]="someVariable"
161
- >
162
- Select volume range
163
- </tui-input-range>
164
-
165
- <input tuiSlider type="range" [min]="100" [max]="1000" size="m" [segments]="5" [step]="0.01"></input>
166
- `;
167
- const FILE_HTML_CHILD_MODULE_BEFORE = `
168
- import {CommonModule} from '@angular/common';
169
- import {NgModule} from '@angular/core';
170
- import {TuiButtonModule, TuiLinkModule} from '@taiga-ui/core';
171
- import {TuiSliderModule} from '@taiga-ui/kit';
172
-
173
- import {TuiMediaExample1} from './examples/1';
174
- import {FileHtmlChildComponent} from './file-html-child.component';
175
- import {ExampleTuiMediaComponent} from './media.component';
176
-
177
- @NgModule({
178
- imports: [
179
- CommonModule,
180
- TuiButtonModule,
181
- TuiSliderModule,
182
- TuiLinkModule,
183
- ],
184
- declarations: [
185
- ExampleTuiMediaComponent,
186
- FileHtmlChildComponent,
187
- TuiMediaExample1,
188
- ],
189
- exports: [ExampleTuiMediaComponent],
190
- })
191
- export class ExampleTuiMediaModule {}
192
- `;
193
- const FILE_HTML_CHILD_MODULE_AFTER = `
194
- import {CommonModule} from '@angular/common';
195
- import {NgModule} from '@angular/core';
196
- import { TuiButtonModule, TuiLinkModule, TuiTextfieldControllerModule } from '@taiga-ui/core';
197
- import {TuiSliderModule} from '@taiga-ui/kit';
198
-
199
- import {TuiMediaExample1} from './examples/1';
200
- import {FileHtmlChildComponent} from './file-html-child.component';
201
- import {ExampleTuiMediaComponent} from './media.component';
202
-
203
- @NgModule({
204
- imports: [
205
- CommonModule,
206
- TuiButtonModule,
207
- TuiSliderModule,
208
- TuiLinkModule,
209
- TuiTextfieldControllerModule
210
- ],
211
- declarations: [
212
- ExampleTuiMediaComponent,
213
- FileHtmlChildComponent,
214
- TuiMediaExample1,
215
- ],
216
- exports: [ExampleTuiMediaComponent],
217
- })
218
- export class ExampleTuiMediaModule {}
219
- `;
220
- const DUMMY_MODULE = `
221
- import {NgModule} from '@angular/core';
222
- import {RouterModule} from '@angular/router';
223
- import {TuiDocCodeModule} from '@taiga-ui/addon-doc';
224
- import {TuiSliderModule} from '@taiga-ui/kit';
225
- import {TuiLinkModule, TuiNotificationModule} from '@taiga-ui/core';
226
-
227
- import {HomeComponent} from './home.component';
228
-
229
- @NgModule({
230
- imports: [RouterModule, TuiDocCodeModule, TuiSliderModule, TuiNotificationModule, TuiLinkModule],
231
- entryComponents: [HomeComponent],
232
- declarations: [HomeComponent],
233
- exports: [HomeComponent],
234
- })
235
- export class HomeModule {}
236
- `;
237
- /** ___test/inline-html-child/*___ */
238
- const INLINE_HTML_CHILD_MODULE_BEFORE = `
239
- import {NgModule} from '@angular/core';
240
- import {FormsModule} from '@angular/forms';
241
- import {TuiHintModule} from '@taiga-ui/core';
242
- import {TuiSliderModule} from '@taiga-ui/kit';
243
- import {InlineHtmlChildComponent} from './inline-html-child.component';
244
-
245
- @NgModule({
246
- imports: [FormsModule, TuiSliderModule, TuiHintModule],
247
- declarations: [InlineHtmlChildComponent]
248
- })
249
- export class ChildModule {}
250
- `;
251
- const INLINE_HTML_CHILD_MODULE_AFTER = `
252
- import {NgModule} from '@angular/core';
253
- import {FormsModule} from '@angular/forms';
254
- import { TuiHintModule, TuiTextfieldControllerModule } from '@taiga-ui/core';
255
- import {TuiSliderModule} from '@taiga-ui/kit';
256
- import {InlineHtmlChildComponent} from './inline-html-child.component';
257
-
258
- @NgModule({
259
- imports: [FormsModule, TuiSliderModule, TuiHintModule, TuiTextfieldControllerModule],
260
- declarations: [InlineHtmlChildComponent]
261
- })
262
- export class ChildModule {}
263
- `;
264
- const INLINE_HTML_CHILD_COMPONENT_BEFORE = `
265
- @Component({
266
- selector: 'inline-html-child',
267
- template: '<tui-input-slider new secondary="123" size="m" [maxLabel]="maxLabel"></tui-input-slider>'
268
- })
269
- export class InlineHtmlChildComponent {
270
- readonly maxLabel = 'MAX (property binding)';
271
- }
272
- `;
273
- const INLINE_HTML_CHILD_COMPONENT_AFTER = `import { TuiContextWithImplicit } from "@taiga-ui/cdk";
274
-
275
- @Component({
276
- selector: 'inline-html-child',
277
- template: '<tui-input-slider tuiTextfieldCustomContent="123" tuiTextfieldSize="m" [valueContent]="tuiMigrationMinMaxLabel"></tui-input-slider>'
278
- })
279
- export class InlineHtmlChildComponent {
280
- readonly maxLabel = 'MAX (property binding)';
281
-
282
- tuiMigrationMinMaxLabel(context: TuiContextWithImplicit<number>): string {
283
- const currentValue = context.$implicit;
284
- const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input
285
- const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label
286
- const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input
287
- const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label
288
- if (currentValue === maxValue) return maxLabelText;
289
- if (currentValue === minValue) return minLabelText;
290
- return String(currentValue);
291
- }
292
- }
293
- `;
294
- describe(`ng-update`, () => {
295
- let host;
296
- let runner;
297
- beforeEach(() => {
298
- host = new testing_1.UnitTestTree(new schematics_1.HostTree());
299
- runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
300
- ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
301
- createMainFiles();
302
- ng_morph_1.saveActiveProject();
303
- });
304
- describe(`no deprecations inside AppComponent`, () => {
305
- it(`no imports of the new module inside app.module.ts`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
306
- const tree = yield runner
307
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
308
- .toPromise();
309
- expect(tree.readContent(`test/app/app.module.ts`)).toBe(APP_MODULE);
310
- }));
311
- it(`no changes in app.template.ts`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
312
- const tree = yield runner
313
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
314
- .toPromise();
315
- expect(tree.readContent(`test/app/app.template.html`)).toBe(APP_TEMPLATE);
316
- }));
317
- it(`no changes in app.component.ts`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
318
- const tree = yield runner
319
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
320
- .toPromise();
321
- expect(tree.readContent(`test/app/app.component.ts`)).toBe(APP_COMPONENT);
322
- }));
323
- });
324
- describe(`component with a inline html template`, () => {
325
- it(`adds TuiTextfieldControllerModule to the required module`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
326
- const tree = yield runner
327
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
328
- .toPromise();
329
- expect(tree.readContent(`test/inline-html-child/inline-html-child.module.ts`)).toBe(INLINE_HTML_CHILD_MODULE_AFTER);
330
- }));
331
- it(`replace deprecated attributes inside inline template (+ adds required class-methods)`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
332
- const tree = yield runner
333
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
334
- .toPromise();
335
- expect(tree.readContent(`test/inline-html-child/inline-html-child.component.ts`)).toEqual(INLINE_HTML_CHILD_COMPONENT_AFTER);
336
- }));
337
- });
338
- describe(`component with a separate html-file template`, () => {
339
- it(`replace deprecated attributes inside templates`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
340
- const tree = yield runner
341
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
342
- .toPromise();
343
- expect(tree.readContent(`test/file-html-child/file-html-child.template.html`)).toEqual(FILE_HTML_CHILD_TEMPLATE_AFTER);
344
- }));
345
- it(`adds required properties inside file-html-child.component.ts`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
346
- const tree = yield runner
347
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
348
- .toPromise();
349
- expect(tree.readContent(`test/file-html-child/file-html-child.component.ts`)).toBe(FILE_HTML_CHILD_COMPONENT_AFTER);
350
- }));
351
- it(`adds TuiTextfieldControllerModule to the required module`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
352
- const tree = yield runner
353
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
354
- .toPromise();
355
- expect(tree.readContent(`test/file-html-child/file-html-child.module.ts`)).toBe(FILE_HTML_CHILD_MODULE_AFTER);
356
- }));
357
- it(`does not add any imports in dummy.module.ts`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
358
- const tree = yield runner
359
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
360
- .toPromise();
361
- expect(tree.readContent(`test/file-html-child/dummy.module.ts`)).toBe(DUMMY_MODULE);
362
- }));
363
- });
364
- afterEach(() => {
365
- ng_morph_1.resetActiveProject();
366
- });
367
- });
368
- function createMainFiles() {
369
- ng_morph_1.createSourceFile(`test/app/app.module.ts`, APP_MODULE);
370
- ng_morph_1.createSourceFile(`test/app/app.component.ts`, APP_COMPONENT);
371
- ng_morph_1.createSourceFile(`test/app/app.template.html`, APP_TEMPLATE);
372
- ng_morph_1.createSourceFile(`test/file-html-child/dummy.module.ts`, DUMMY_MODULE);
373
- ng_morph_1.createSourceFile(`test/file-html-child/file-html-child.module.ts`, FILE_HTML_CHILD_MODULE_BEFORE);
374
- ng_morph_1.createSourceFile(`test/file-html-child/file-html-child.component.ts`, FILE_HTML_CHILD_COMPONENT_BEFORE);
375
- ng_morph_1.createSourceFile(`test/file-html-child/file-html-child.template.html`, FILE_HTML_CHILD_TEMPLATE_BEFORE);
376
- ng_morph_1.createSourceFile(`test/inline-html-child/inline-html-child.module.ts`, INLINE_HTML_CHILD_MODULE_BEFORE);
377
- ng_morph_1.createSourceFile(`test/inline-html-child/inline-html-child.component.ts`, INLINE_HTML_CHILD_COMPONENT_BEFORE);
378
- create_angular_json_1.createAngularJson();
379
- ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
380
- }
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /* eslint-disable rxjs/no-topromise */
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const testing_1 = require("@angular-devkit/schematics/testing");
7
- const ng_morph_1 = require("ng-morph");
8
- const path_1 = require("path");
9
- const versions_1 = require("../../../ng-add/constants/versions");
10
- const collectionPath = path_1.join(__dirname, `../../../migration.json`);
11
- describe(`ng-update angular.json`, () => {
12
- let host;
13
- let runner;
14
- beforeEach(() => {
15
- host = new testing_1.UnitTestTree(new schematics_1.HostTree());
16
- runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
17
- });
18
- it(`include @taiga-ui/proprietary-icons inside a package.json`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
19
- ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
20
- ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0", "@taiga-ui/proprietary-icons": "${versions_1.TAIGA_VERSION}"}}`, { overwrite: true });
21
- ng_morph_1.createSourceFile(`angular.json`, makeAngularJsonWithAssets(`
22
- {
23
- "glob": "**/*",
24
- "input": "node_modules/@taiga-ui/proprietary-icons/src",
25
- "output": "assets/taiga-ui/icons"
26
- }`));
27
- ng_morph_1.saveActiveProject();
28
- const tree = yield runner
29
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
30
- .toPromise();
31
- expect(tree.readContent(`angular.json`)).toEqual(makeAngularJsonWithAssets(`
32
- {
33
- "glob": "**/*",
34
- "input": "node_modules/@taiga-ui/proprietary-icons/src",
35
- "output": "assets/taiga-ui/icons"
36
- },
37
- {
38
- "glob": "**/*",
39
- "input": "node_modules/@taiga-ui/proprietary-tds-icons/src",
40
- "output": "assets/taiga-ui/icons"
41
- }`));
42
- }));
43
- it(`it included proprietary-tds-icons now`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
44
- ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
45
- ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0", "@taiga-ui/proprietary-icons": "${versions_1.TAIGA_VERSION}"}}`);
46
- ng_morph_1.createSourceFile(`angular.json`, makeAngularJsonWithAssets(`
47
- {
48
- "glob": "**/*",
49
- "input": "node_modules/@taiga-ui/proprietary-tds-icons/src",
50
- "output": "assets/taiga-ui/icons"
51
- },
52
- {
53
- "glob": "**/*",
54
- "input": "node_modules/@taiga-ui/proprietary-icons/src",
55
- "output": "assets/taiga-ui/icons"
56
- }`));
57
- ng_morph_1.saveActiveProject();
58
- const tree = yield runner
59
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
60
- .toPromise();
61
- expect(tree.readContent(`angular.json`)).toEqual(makeAngularJsonWithAssets(`
62
- {
63
- "glob": "**/*",
64
- "input": "node_modules/@taiga-ui/proprietary-tds-icons/src",
65
- "output": "assets/taiga-ui/icons"
66
- },
67
- {
68
- "glob": "**/*",
69
- "input": "node_modules/@taiga-ui/proprietary-icons/src",
70
- "output": "assets/taiga-ui/icons"
71
- }`));
72
- }));
73
- it(`doesn't include @taiga-ui/proprietary-icons inside a package.json`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
74
- ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
75
- ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
76
- ng_morph_1.createSourceFile(`angular.json`, makeAngularJsonWithAssets(`
77
- {
78
- "glob": "**/*",
79
- "input": "node_modules/@taiga-ui/proprietary-icons/src",
80
- "output": "assets/taiga-ui/icons"
81
- }`));
82
- ng_morph_1.saveActiveProject();
83
- const tree = yield runner
84
- .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
85
- .toPromise();
86
- expect(tree.readContent(`angular.json`)).toEqual(makeAngularJsonWithAssets(`
87
- {
88
- "glob": "**/*",
89
- "input": "node_modules/@taiga-ui/proprietary-icons/src",
90
- "output": "assets/taiga-ui/icons"
91
- }`));
92
- }));
93
- afterEach(() => ng_morph_1.resetActiveProject());
94
- });
95
- function makeAngularJsonWithAssets(assets) {
96
- return `
97
- {
98
- "version": 1,
99
- "defaultProject": "demo",
100
- "projects": {
101
- "demo": {
102
- "architect": {
103
- "build": {
104
- "options": {
105
- "main": "test/main.ts",
106
- "styles": [
107
- "node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less",
108
- "node_modules/@taiga-ui/styles/taiga-ui-global.less",
109
- "some.style"
110
- ],
111
- "assets": [${assets}
112
- ]
113
- }
114
- }
115
- }
116
- }
117
- }
118
- }`;
119
- }