@taiga-ui/cdk 3.44.0 → 3.44.1-canary.b6b867c
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/bundles/taiga-ui-cdk-abstract.umd.js +4 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/esm2015/abstract/interactive.js +5 -2
- package/esm2015/constants/version.js +2 -2
- package/fesm2015/taiga-ui-cdk-abstract.js +5 -2
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/tests/schematic-ng-add-standalone.spec.d.ts +1 -0
- package/schematics/ng-add/tests/schematic-ng-add-standalone.spec.js +381 -0
- package/schematics/ng-add/tests/schematic-ng-add.spec.d.ts +1 -0
- package/schematics/ng-add/tests/schematic-ng-add.spec.js +270 -0
- package/schematics/ng-update/v3/tests/schematic-date-time.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-date-time.spec.js +117 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-hints.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-hints.spec.js +102 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-polymorpheus.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-polymorpheus.spec.js +107 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-progress.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-progress.spec.js +113 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-sliders.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-sliders.spec.js +380 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-tds.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-tds.spec.js +119 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-textfields.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-migrate-textfields.spec.js +123 -0
- package/schematics/ng-update/v3/tests/schematic-miscellaneous.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-miscellaneous.spec.js +81 -0
- package/schematics/ng-update/v3/tests/schematic-rename-types.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-rename-types.spec.js +157 -0
- package/schematics/ng-update/v3/tests/schematic-replace-consts.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-consts.spec.js +135 -0
- package/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.js +53 -0
- package/schematics/ng-update/v3/tests/schematic-replace-deprecated-functions.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-deprecated-functions.spec.js +835 -0
- package/schematics/ng-update/v3/tests/schematic-replace-enums.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-enums.spec.js +68 -0
- package/schematics/ng-update/v3/tests/schematic-replace-functions.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-functions.spec.js +195 -0
- package/schematics/ng-update/v3/tests/schematic-replace-html.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-html.spec.js +611 -0
- package/schematics/ng-update/v3/tests/schematic-replace-proprietary-consts.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-proprietary-consts.spec.js +100 -0
- package/schematics/ng-update/v3/tests/schematic-replace-services.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-services.spec.js +102 -0
- package/schematics/ng-update/v3/tests/schematic-replace-styles.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-replace-styles.spec.js +286 -0
- package/schematics/ng-update/v3/tests/schematic-textfield-icon.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-textfield-icon.spec.js +141 -0
- package/schematics/ng-update/v3/tests/schematic-warnings.spec.d.ts +1 -0
- package/schematics/ng-update/v3/tests/schematic-warnings.spec.js +104 -0
- package/schematics/ng-update/v3-30/tests/schematic-migrate-icons.spec.d.ts +1 -0
- package/schematics/ng-update/v3-30/tests/schematic-migrate-icons.spec.js +87 -0
- package/schematics/ng-update/v3-35/tests/schematic-migrate-icons.spec.d.ts +1 -0
- package/schematics/ng-update/v3-35/tests/schematic-migrate-icons.spec.js +101 -0
- package/schematics/ng-update/v3-36/tests/schematic-migrate-editor.spec.d.ts +1 -0
- package/schematics/ng-update/v3-36/tests/schematic-migrate-editor.spec.js +117 -0
- package/schematics/ng-update/v3-40/tests/schematic-migrate-textarea.spec.d.ts +1 -0
- package/schematics/ng-update/v3-40/tests/schematic-migrate-textarea.spec.js +90 -0
- package/schematics/ng-update/v3-5/tests/schematic-migrate-templates.spec.d.ts +1 -0
- package/schematics/ng-update/v3-5/tests/schematic-migrate-templates.spec.js +74 -0
- package/schematics/ng-update/v4/tests/schematic-migrate-thumbnail-card.spec.d.ts +1 -0
- package/schematics/ng-update/v4/tests/schematic-migrate-thumbnail-card.spec.js +72 -0
|
@@ -0,0 +1,270 @@
|
|
|
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 versions_1 = require("../constants/versions");
|
|
11
|
+
const collectionPath = path_1.join(__dirname, `../../collection.json`);
|
|
12
|
+
describe(`ng-add`, () => {
|
|
13
|
+
let host;
|
|
14
|
+
let runner;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
|
17
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
|
18
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
|
19
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
|
20
|
+
create_angular_json_1.createAngularJson();
|
|
21
|
+
createMainFiles();
|
|
22
|
+
ng_morph_1.saveActiveProject();
|
|
23
|
+
});
|
|
24
|
+
it(`should add main modules in package.json`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const options = {
|
|
26
|
+
addSanitizer: false,
|
|
27
|
+
addGlobalStyles: false,
|
|
28
|
+
addDialogsModule: false,
|
|
29
|
+
addAlertModule: false,
|
|
30
|
+
addons: [],
|
|
31
|
+
project: ``,
|
|
32
|
+
'skip-logs': process.env[`TUI_CI`] === `true`,
|
|
33
|
+
};
|
|
34
|
+
const tree = yield runner.runSchematicAsync(`ng-add`, options, host).toPromise();
|
|
35
|
+
expect(tree.readContent(`package.json`)).toEqual(`{
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@angular/core": "~13.0.0",
|
|
38
|
+
"@taiga-ui/cdk": "${versions_1.TAIGA_VERSION}",
|
|
39
|
+
"@taiga-ui/core": "${versions_1.TAIGA_VERSION}",
|
|
40
|
+
"@taiga-ui/icons": "${versions_1.TAIGA_VERSION}",
|
|
41
|
+
"@taiga-ui/kit": "${versions_1.TAIGA_VERSION}"
|
|
42
|
+
}
|
|
43
|
+
}`);
|
|
44
|
+
}));
|
|
45
|
+
it(`should add additional modules in package.json`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const options = {
|
|
47
|
+
addSanitizer: true,
|
|
48
|
+
addGlobalStyles: false,
|
|
49
|
+
addDialogsModule: false,
|
|
50
|
+
addAlertModule: false,
|
|
51
|
+
addons: [`addon-doc`, `addon-mobile`],
|
|
52
|
+
project: ``,
|
|
53
|
+
'skip-logs': process.env[`TUI_CI`] === `true`,
|
|
54
|
+
};
|
|
55
|
+
const tree = yield runner.runSchematicAsync(`ng-add`, options, host).toPromise();
|
|
56
|
+
expect(tree.readContent(`package.json`)).toEqual(`{
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/dompurify": "${versions_1.DOMPURIFY_TYPES_VERSION}"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@angular/cdk": "^13.0.0",
|
|
62
|
+
"@angular/core": "~13.0.0",
|
|
63
|
+
"@taiga-ui/addon-doc": "${versions_1.TAIGA_VERSION}",
|
|
64
|
+
"@taiga-ui/addon-mobile": "${versions_1.TAIGA_VERSION}",
|
|
65
|
+
"@taiga-ui/cdk": "${versions_1.TAIGA_VERSION}",
|
|
66
|
+
"@taiga-ui/core": "${versions_1.TAIGA_VERSION}",
|
|
67
|
+
"@taiga-ui/icons": "${versions_1.TAIGA_VERSION}",
|
|
68
|
+
"@taiga-ui/kit": "${versions_1.TAIGA_VERSION}",
|
|
69
|
+
"@tinkoff/ng-dompurify": "${versions_1.NG_DOMPURIFY_VERSION}",
|
|
70
|
+
"dompurify": "${versions_1.DOMPURIFY_VERSION}"
|
|
71
|
+
}
|
|
72
|
+
}`);
|
|
73
|
+
}));
|
|
74
|
+
it(`should add additional modules in package.json and global styles`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
const options = {
|
|
76
|
+
addSanitizer: true,
|
|
77
|
+
addGlobalStyles: true,
|
|
78
|
+
addDialogsModule: false,
|
|
79
|
+
addAlertModule: false,
|
|
80
|
+
addons: [`addon-doc`, `addon-mobile`],
|
|
81
|
+
project: ``,
|
|
82
|
+
'skip-logs': process.env[`TUI_CI`] === `true`,
|
|
83
|
+
};
|
|
84
|
+
const tree = yield runner.runSchematicAsync(`ng-add`, options, host).toPromise();
|
|
85
|
+
expect(tree.readContent(`package.json`)).toEqual(`{
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@types/dompurify": "${versions_1.DOMPURIFY_TYPES_VERSION}"
|
|
88
|
+
},
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"@angular/cdk": "^13.0.0",
|
|
91
|
+
"@angular/core": "~13.0.0",
|
|
92
|
+
"@taiga-ui/addon-doc": "${versions_1.TAIGA_VERSION}",
|
|
93
|
+
"@taiga-ui/addon-mobile": "${versions_1.TAIGA_VERSION}",
|
|
94
|
+
"@taiga-ui/cdk": "${versions_1.TAIGA_VERSION}",
|
|
95
|
+
"@taiga-ui/core": "${versions_1.TAIGA_VERSION}",
|
|
96
|
+
"@taiga-ui/icons": "${versions_1.TAIGA_VERSION}",
|
|
97
|
+
"@taiga-ui/kit": "${versions_1.TAIGA_VERSION}",
|
|
98
|
+
"@taiga-ui/styles": "${versions_1.TAIGA_VERSION}",
|
|
99
|
+
"@tinkoff/ng-dompurify": "${versions_1.NG_DOMPURIFY_VERSION}",
|
|
100
|
+
"dompurify": "${versions_1.DOMPURIFY_VERSION}"
|
|
101
|
+
}
|
|
102
|
+
}`);
|
|
103
|
+
}));
|
|
104
|
+
it(`should add assets and styles in angular.json`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
+
const tree = yield runner
|
|
106
|
+
.runSchematicAsync(`ng-add-setup-project`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
|
107
|
+
.toPromise();
|
|
108
|
+
expect(tree.readContent(`angular.json`)).toEqual(`
|
|
109
|
+
{
|
|
110
|
+
"version": 1,
|
|
111
|
+
"defaultProject": "demo",
|
|
112
|
+
"projects": {
|
|
113
|
+
"demo": {
|
|
114
|
+
"architect": {
|
|
115
|
+
"build": {
|
|
116
|
+
"options": {
|
|
117
|
+
"main": "test/main.ts",
|
|
118
|
+
"styles": [
|
|
119
|
+
"node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
|
|
120
|
+
"node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less"
|
|
121
|
+
],
|
|
122
|
+
"assets": [
|
|
123
|
+
{
|
|
124
|
+
"glob": "**/*",
|
|
125
|
+
"input": "node_modules/@taiga-ui/icons/src",
|
|
126
|
+
"output": "assets/taiga-ui/icons"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}`);
|
|
135
|
+
}));
|
|
136
|
+
it(`should add styles without duplicates, taiga styles first`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
137
|
+
create_angular_json_1.createAngularJson({ stylesExist: true });
|
|
138
|
+
ng_morph_1.saveActiveProject();
|
|
139
|
+
const tree = yield runner
|
|
140
|
+
.runSchematicAsync(`ng-add-setup-project`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
|
141
|
+
.toPromise();
|
|
142
|
+
expect(tree.readContent(`angular.json`)).toEqual(`
|
|
143
|
+
{
|
|
144
|
+
"version": 1,
|
|
145
|
+
"defaultProject": "demo",
|
|
146
|
+
"projects": {
|
|
147
|
+
"demo": {
|
|
148
|
+
"architect": {
|
|
149
|
+
"build": {
|
|
150
|
+
"options": {
|
|
151
|
+
"main": "test/main.ts",
|
|
152
|
+
"styles": [
|
|
153
|
+
"node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
|
|
154
|
+
"node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less",
|
|
155
|
+
"some.style"
|
|
156
|
+
],
|
|
157
|
+
"assets": [
|
|
158
|
+
{
|
|
159
|
+
"glob": "**/*",
|
|
160
|
+
"input": "node_modules/@taiga-ui/icons/src",
|
|
161
|
+
"output": "assets/taiga-ui/icons"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}`);
|
|
170
|
+
}));
|
|
171
|
+
it(`should add global styles`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
172
|
+
create_angular_json_1.createAngularJson({ stylesExist: true });
|
|
173
|
+
ng_morph_1.saveActiveProject();
|
|
174
|
+
const tree = yield runner
|
|
175
|
+
.runSchematicAsync(`ng-add-setup-project`, { addGlobalStyles: true }, host)
|
|
176
|
+
.toPromise();
|
|
177
|
+
expect(tree.readContent(`angular.json`)).toEqual(`
|
|
178
|
+
{
|
|
179
|
+
"version": 1,
|
|
180
|
+
"defaultProject": "demo",
|
|
181
|
+
"projects": {
|
|
182
|
+
"demo": {
|
|
183
|
+
"architect": {
|
|
184
|
+
"build": {
|
|
185
|
+
"options": {
|
|
186
|
+
"main": "test/main.ts",
|
|
187
|
+
"styles": [
|
|
188
|
+
"node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
|
|
189
|
+
"node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less",
|
|
190
|
+
"node_modules/@taiga-ui/styles/taiga-ui-global.less",
|
|
191
|
+
"some.style"
|
|
192
|
+
],
|
|
193
|
+
"assets": [
|
|
194
|
+
{
|
|
195
|
+
"glob": "**/*",
|
|
196
|
+
"input": "node_modules/@taiga-ui/icons/src",
|
|
197
|
+
"output": "assets/taiga-ui/icons"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}`);
|
|
206
|
+
}));
|
|
207
|
+
it(`Should add Taiga-ui modules and providers to main module`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
+
const options = {
|
|
209
|
+
addSanitizer: true,
|
|
210
|
+
addGlobalStyles: false,
|
|
211
|
+
addDialogsModule: true,
|
|
212
|
+
addAlertModule: true,
|
|
213
|
+
addons: [],
|
|
214
|
+
project: ``,
|
|
215
|
+
'skip-logs': process.env[`TUI_CI`] === `true`,
|
|
216
|
+
};
|
|
217
|
+
const tree = yield runner
|
|
218
|
+
.runSchematicAsync(`ng-add-setup-project`, options, host)
|
|
219
|
+
.toPromise();
|
|
220
|
+
expect(tree.readContent(`test/app/app.module.ts`)).toEqual(`import { NgDompurifySanitizer } from "@tinkoff/ng-dompurify";
|
|
221
|
+
import { TuiRootModule, TuiDialogModule, TuiAlertModule, TUI_SANITIZER } from "@taiga-ui/core";
|
|
222
|
+
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
|
223
|
+
import {NgModule} from '@angular/core';
|
|
224
|
+
import {AppComponent} from './app.component';
|
|
225
|
+
|
|
226
|
+
@NgModule({declarations: [AppComponent],
|
|
227
|
+
imports: [BrowserAnimationsModule, TuiRootModule, TuiDialogModule, TuiAlertModule],
|
|
228
|
+
providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}]
|
|
229
|
+
})
|
|
230
|
+
export class AppModule {}
|
|
231
|
+
`);
|
|
232
|
+
}));
|
|
233
|
+
it(`Should wrap main template with tui-root`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
234
|
+
const tree = yield runner
|
|
235
|
+
.runSchematicAsync(`ng-add-setup-project`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
|
236
|
+
.toPromise();
|
|
237
|
+
expect(tree.readContent(`test/app/app.template.html`)).toEqual(`<tui-root>
|
|
238
|
+
<app></app>
|
|
239
|
+
</tui-root>`);
|
|
240
|
+
}));
|
|
241
|
+
afterEach(() => {
|
|
242
|
+
ng_morph_1.resetActiveProject();
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
function createMainFiles() {
|
|
246
|
+
ng_morph_1.createSourceFile(`test/main.ts`, `import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
|
247
|
+
import {AppModule} from './app/app.module';
|
|
248
|
+
import {environment} from './environments/environment';
|
|
249
|
+
|
|
250
|
+
if (environment.production) {
|
|
251
|
+
enableProdMode();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
platformBrowserDynamic()
|
|
255
|
+
.bootstrapModule(AppModule)
|
|
256
|
+
.catch(err => console.log(err));
|
|
257
|
+
`);
|
|
258
|
+
ng_morph_1.createSourceFile(`test/app/app.module.ts`, `import {NgModule} from '@angular/core';
|
|
259
|
+
import {AppComponent} from './app.component';
|
|
260
|
+
|
|
261
|
+
@NgModule({declarations: [AppComponent]})
|
|
262
|
+
export class AppModule {}
|
|
263
|
+
`);
|
|
264
|
+
ng_morph_1.createSourceFile(`test/app/app.component.ts`, `import {Component} from '@angular/core';
|
|
265
|
+
import {AppComponent} from './app.component';
|
|
266
|
+
|
|
267
|
+
@Component({templateUrl: './app.template.html'})
|
|
268
|
+
export class AppComponent {}`);
|
|
269
|
+
ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
|
|
270
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
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 BEFORE = `import {Component} from '@angular/core';
|
|
12
|
+
import {TuiDay, TuiMonth, TuiDayRange} from '@taiga-ui/cdk';
|
|
13
|
+
|
|
14
|
+
const day = new TuiDay(0, 0, 10).formattedDay;
|
|
15
|
+
|
|
16
|
+
@Component({templateUrl: './app.template.html'})
|
|
17
|
+
export class AppComponent {
|
|
18
|
+
some = new TuiDay();
|
|
19
|
+
formatted = new TuiDay().formattedDay;
|
|
20
|
+
|
|
21
|
+
range = new TuiDayRange(this.some, this.some);
|
|
22
|
+
formattedRange = this.range.formattedDayRange;
|
|
23
|
+
normalized = TuiDayRange.normalizeParse(a, b, c);
|
|
24
|
+
|
|
25
|
+
other: TuiDay = getTuiDay();
|
|
26
|
+
value: TuiMonth | null = null;
|
|
27
|
+
|
|
28
|
+
show(): void {
|
|
29
|
+
const kek = this.some;
|
|
30
|
+
kek.formattedDay;
|
|
31
|
+
this.some.formattedDay;
|
|
32
|
+
|
|
33
|
+
this.other.formattedDay;
|
|
34
|
+
|
|
35
|
+
this.other.getDayFromMonthRowCol(1, 2, 3);
|
|
36
|
+
|
|
37
|
+
return this.value.formattedMonth;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
dummyFn1() {
|
|
41
|
+
const {value, var1} = this;
|
|
42
|
+
|
|
43
|
+
return value.notDeprecatedProperty;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
dummyFn2() {
|
|
47
|
+
const {value, var2} = this;
|
|
48
|
+
}
|
|
49
|
+
}`;
|
|
50
|
+
const AFTER = `import {Component} from '@angular/core';
|
|
51
|
+
import {TuiDay, TuiMonth, TuiDayRange} from '@taiga-ui/cdk';
|
|
52
|
+
|
|
53
|
+
const day = new TuiDay(0, 0, 10).getFormattedDay("DMY", ".");
|
|
54
|
+
|
|
55
|
+
@Component({templateUrl: './app.template.html'})
|
|
56
|
+
export class AppComponent {
|
|
57
|
+
some = new TuiDay();
|
|
58
|
+
formatted = new TuiDay().getFormattedDay("DMY", ".");
|
|
59
|
+
|
|
60
|
+
range = new TuiDayRange(this.some, this.some);
|
|
61
|
+
formattedRange = this.range.getFormattedDayRange("DMY", ".");
|
|
62
|
+
normalized = TuiDayRange.normalizeParse(a, "DMY");
|
|
63
|
+
|
|
64
|
+
other: TuiDay = getTuiDay();
|
|
65
|
+
value: TuiMonth | null = null;
|
|
66
|
+
|
|
67
|
+
show(): void {
|
|
68
|
+
const kek = this.some;
|
|
69
|
+
kek.getFormattedDay("DMY", ".");
|
|
70
|
+
this.some.getFormattedDay("DMY", ".");
|
|
71
|
+
|
|
72
|
+
this.other.getFormattedDay("DMY", ".");
|
|
73
|
+
|
|
74
|
+
// TODO: (Taiga UI migration) getDayFromMonthRowCol has been removed in 3.0. If you need this utils check out this pipe https://github.com/taiga-family/taiga-ui/tree/main/projects/core/pipes/calendar-sheet
|
|
75
|
+
this.other.getDayFromMonthRowCol(1, 2, 3);
|
|
76
|
+
|
|
77
|
+
// TODO: (Taiga UI migration) formattedMonth has been removed in 3.0. Please use TUI_MONTH_FORMATTER from @taiga-ui/kit
|
|
78
|
+
return this.value.formattedMonth;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
dummyFn1() {
|
|
82
|
+
const {value, var1} = this;
|
|
83
|
+
|
|
84
|
+
return value.notDeprecatedProperty;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
dummyFn2() {
|
|
88
|
+
const {value, var2} = this;
|
|
89
|
+
}
|
|
90
|
+
}`;
|
|
91
|
+
describe(`ng-update`, () => {
|
|
92
|
+
let host;
|
|
93
|
+
let runner;
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
|
96
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
|
97
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
|
98
|
+
createMainFiles();
|
|
99
|
+
ng_morph_1.saveActiveProject();
|
|
100
|
+
});
|
|
101
|
+
it(`date-time migrations`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
const tree = yield runner
|
|
103
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
|
104
|
+
.toPromise();
|
|
105
|
+
expect(tree.readContent(`test/app/app.component.ts`)).toEqual(AFTER);
|
|
106
|
+
}));
|
|
107
|
+
afterEach(() => {
|
|
108
|
+
ng_morph_1.resetActiveProject();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
function createMainFiles() {
|
|
112
|
+
ng_morph_1.createSourceFile(`test/app/app.component.ts`, BEFORE);
|
|
113
|
+
ng_morph_1.createSourceFile(`test/app/mock.ts`, `export class TuiDay {}`);
|
|
114
|
+
ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
|
|
115
|
+
create_angular_json_1.createAngularJson();
|
|
116
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
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 COMPONENT_WITH_TEMPLATE_URL = `
|
|
12
|
+
@Component({templateUrl: './test.template.html'})
|
|
13
|
+
export class TestComponent {}
|
|
14
|
+
`;
|
|
15
|
+
const TEMPLATE_BEFORE = `
|
|
16
|
+
<button
|
|
17
|
+
tuiButton
|
|
18
|
+
tuiHintDirection="bottom-middle"
|
|
19
|
+
tuiHintMode="onDark"
|
|
20
|
+
tuiPointerHint="Wow! How exciting!"
|
|
21
|
+
></button>
|
|
22
|
+
|
|
23
|
+
<button
|
|
24
|
+
tuiButton
|
|
25
|
+
type="button"
|
|
26
|
+
[tuiManualHint]="template"
|
|
27
|
+
[tuiManualHintShow]="hintShown"
|
|
28
|
+
(click)="toggleHint()"
|
|
29
|
+
>
|
|
30
|
+
Hint
|
|
31
|
+
</button>
|
|
32
|
+
|
|
33
|
+
<tui-bar-chart
|
|
34
|
+
class="chart"
|
|
35
|
+
[value]="value"
|
|
36
|
+
[hintContent]="hint"
|
|
37
|
+
[hintMode]="appearance"
|
|
38
|
+
></tui-bar-chart>
|
|
39
|
+
|
|
40
|
+
<tui-tooltip
|
|
41
|
+
describeId="example3"
|
|
42
|
+
mode="onDark"
|
|
43
|
+
content="some tooltip content"
|
|
44
|
+
></tui-tooltip>
|
|
45
|
+
`;
|
|
46
|
+
const TEMPLATE_AFTER = `
|
|
47
|
+
<button
|
|
48
|
+
tuiButton
|
|
49
|
+
tuiHintDirection="bottom"
|
|
50
|
+
tuiHintAppearance="onDark"
|
|
51
|
+
tuiHintPointer tuiHint="Wow! How exciting!"
|
|
52
|
+
></button>
|
|
53
|
+
|
|
54
|
+
<button
|
|
55
|
+
tuiButton
|
|
56
|
+
type="button"
|
|
57
|
+
[tuiHint]="template"
|
|
58
|
+
[tuiHintManual]="hintShown"
|
|
59
|
+
(click)="toggleHint()"
|
|
60
|
+
>
|
|
61
|
+
Hint
|
|
62
|
+
</button>
|
|
63
|
+
|
|
64
|
+
<tui-bar-chart
|
|
65
|
+
class="chart"
|
|
66
|
+
[value]="value"
|
|
67
|
+
[tuiHintContent]="hint"
|
|
68
|
+
[tuiHintAppearance]="appearance"
|
|
69
|
+
></tui-bar-chart>
|
|
70
|
+
|
|
71
|
+
<tui-tooltip
|
|
72
|
+
describeId="example3"
|
|
73
|
+
appearance="onDark"
|
|
74
|
+
content="some tooltip content"
|
|
75
|
+
></tui-tooltip>
|
|
76
|
+
`;
|
|
77
|
+
describe(`ng-update`, () => {
|
|
78
|
+
let host;
|
|
79
|
+
let runner;
|
|
80
|
+
beforeEach(() => {
|
|
81
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
|
82
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
|
83
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
|
84
|
+
createMainFiles();
|
|
85
|
+
ng_morph_1.saveActiveProject();
|
|
86
|
+
});
|
|
87
|
+
it(`should migrate polymorpheus`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
const tree = yield runner
|
|
89
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
|
90
|
+
.toPromise();
|
|
91
|
+
expect(tree.readContent(`test/app/test.template.html`)).toEqual(TEMPLATE_AFTER);
|
|
92
|
+
}));
|
|
93
|
+
afterEach(() => {
|
|
94
|
+
ng_morph_1.resetActiveProject();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
function createMainFiles() {
|
|
98
|
+
ng_morph_1.createSourceFile(`test/app/test.component.ts`, COMPONENT_WITH_TEMPLATE_URL);
|
|
99
|
+
ng_morph_1.createSourceFile(`test/app/test.template.html`, TEMPLATE_BEFORE);
|
|
100
|
+
create_angular_json_1.createAngularJson();
|
|
101
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
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 COMPONENT_WITH_TEMPLATE_URL = `
|
|
12
|
+
@Component({templateUrl: './test.template.html'})
|
|
13
|
+
export class TestComponent {}
|
|
14
|
+
`;
|
|
15
|
+
const TEMPLATE_BEFORE = `
|
|
16
|
+
<div
|
|
17
|
+
polymorpheus-outlet
|
|
18
|
+
[content]="content"
|
|
19
|
+
[context]="myContext"
|
|
20
|
+
></div>
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
polymorpheus-outlet
|
|
24
|
+
[content]="content"
|
|
25
|
+
[context]="context"
|
|
26
|
+
>
|
|
27
|
+
<ng-template let-hapicaCamelCase>
|
|
28
|
+
<div>{{ hapicaCamelCase }}</div>
|
|
29
|
+
</ng-template>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div
|
|
33
|
+
*ngIf="icon"
|
|
34
|
+
polymorpheus-outlet
|
|
35
|
+
class="t-icon-outlet"
|
|
36
|
+
[content]="icon"
|
|
37
|
+
>
|
|
38
|
+
<ng-template let-icon>
|
|
39
|
+
<tui-svg
|
|
40
|
+
automation-id="tui-input-card-grouped__icon"
|
|
41
|
+
class="t-card"
|
|
42
|
+
[src]="icon"
|
|
43
|
+
></tui-svg>
|
|
44
|
+
</ng-template>
|
|
45
|
+
</div>
|
|
46
|
+
`;
|
|
47
|
+
const TEMPLATE_AFTER = `
|
|
48
|
+
<div
|
|
49
|
+
${``}
|
|
50
|
+
${``}
|
|
51
|
+
${``}
|
|
52
|
+
>
|
|
53
|
+
<ng-container *polymorpheusOutlet="content as text; context: myContext">
|
|
54
|
+
{{ text }}
|
|
55
|
+
</ng-container></div>
|
|
56
|
+
|
|
57
|
+
<div
|
|
58
|
+
${``}
|
|
59
|
+
${``}
|
|
60
|
+
${``}
|
|
61
|
+
>
|
|
62
|
+
<ng-container *polymorpheusOutlet="content as hapicaCamelCase; context: context" >
|
|
63
|
+
<div>{{ hapicaCamelCase }}</div>
|
|
64
|
+
</ng-container>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div
|
|
68
|
+
*ngIf="icon"
|
|
69
|
+
${``}
|
|
70
|
+
class="t-icon-outlet"
|
|
71
|
+
${``}
|
|
72
|
+
>
|
|
73
|
+
<ng-container *polymorpheusOutlet="icon as icon" >
|
|
74
|
+
<tui-svg
|
|
75
|
+
automation-id="tui-input-card-grouped__icon"
|
|
76
|
+
class="t-card"
|
|
77
|
+
[src]="icon"
|
|
78
|
+
></tui-svg>
|
|
79
|
+
</ng-container>
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
describe(`ng-update`, () => {
|
|
83
|
+
let host;
|
|
84
|
+
let runner;
|
|
85
|
+
beforeEach(() => {
|
|
86
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
|
87
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
|
88
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
|
89
|
+
createMainFiles();
|
|
90
|
+
ng_morph_1.saveActiveProject();
|
|
91
|
+
});
|
|
92
|
+
it(`should migrate polymorpheus`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
+
const tree = yield runner
|
|
94
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
|
95
|
+
.toPromise();
|
|
96
|
+
expect(tree.readContent(`test/app/test.template.html`)).toEqual(TEMPLATE_AFTER);
|
|
97
|
+
}));
|
|
98
|
+
afterEach(() => {
|
|
99
|
+
ng_morph_1.resetActiveProject();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
function createMainFiles() {
|
|
103
|
+
ng_morph_1.createSourceFile(`test/app/test.component.ts`, COMPONENT_WITH_TEMPLATE_URL);
|
|
104
|
+
ng_morph_1.createSourceFile(`test/app/test.template.html`, TEMPLATE_BEFORE);
|
|
105
|
+
create_angular_json_1.createAngularJson();
|
|
106
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|