@taiga-ui/cdk 3.44.1-canary.aef8c35 → 3.44.1-canary.fd7a856
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-tokens.umd.js +86 -123
- package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +6 -10
- package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
- package/esm2015/abstract/interactive.js +5 -2
- package/esm2015/tokens/active-element.js +38 -40
- package/esm2015/tokens/default-renderer.js +6 -6
- package/esm2015/tokens/ensure-base-href.js +12 -13
- package/esm2015/tokens/is-android.js +4 -5
- package/esm2015/tokens/is-apple.js +4 -6
- package/esm2015/tokens/is-chromium.js +4 -5
- package/esm2015/tokens/is-cypress.js +4 -5
- package/esm2015/tokens/is-e2e.js +4 -5
- package/esm2015/tokens/is-firefox.js +6 -7
- package/esm2015/tokens/is-ios.js +4 -6
- package/esm2015/tokens/is-mobile.js +5 -6
- package/esm2015/tokens/is-playwright.js +3 -5
- package/esm2015/tokens/is-stackblitz.js +4 -5
- package/esm2015/tokens/is-webkit.js +6 -7
- package/esm2015/tokens/range.js +4 -5
- package/esm2015/tokens/removed-element.js +13 -14
- package/esm2015/tokens/take-only-trusted-events.js +3 -5
- package/esm2015/tokens/touch-supported.js +4 -5
- package/esm2015/tokens/window-height.js +4 -5
- package/esm2015/utils/miscellaneous/create-options.js +3 -5
- package/esm2015/utils/miscellaneous/create-token.js +2 -4
- package/fesm2015/taiga-ui-cdk-abstract.js +5 -2
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-tokens.js +79 -116
- package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +6 -10
- package/fesm2015/taiga-ui-cdk-utils-miscellaneous.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
- package/tokens/active-element.d.ts +1 -2
- package/tokens/default-renderer.d.ts +2 -2
- package/tokens/ensure-base-href.d.ts +1 -2
- package/tokens/is-android.d.ts +1 -2
- package/tokens/is-apple.d.ts +1 -2
- package/tokens/is-chromium.d.ts +1 -2
- package/tokens/is-cypress.d.ts +1 -2
- package/tokens/is-e2e.d.ts +1 -2
- package/tokens/is-firefox.d.ts +1 -2
- package/tokens/is-ios.d.ts +1 -2
- package/tokens/is-mobile.d.ts +1 -2
- package/tokens/is-playwright.d.ts +1 -2
- package/tokens/is-stackblitz.d.ts +1 -2
- package/tokens/is-webkit.d.ts +1 -2
- package/tokens/range.d.ts +1 -2
- package/tokens/removed-element.d.ts +1 -3
- package/tokens/take-only-trusted-events.d.ts +1 -2
- package/tokens/touch-supported.d.ts +1 -2
- package/tokens/window-height.d.ts +1 -3
@@ -0,0 +1,81 @@
|
|
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 {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce';
|
13
|
+
import {TuiDirectiveStylesService} from '@taiga-ui/cdk';
|
14
|
+
|
15
|
+
const lineType: TuiCurrency = TuiCurrency.HongKong_dollar;
|
16
|
+
|
17
|
+
@Component({templateUrl: './app.template.html'})
|
18
|
+
export class AppComponent {
|
19
|
+
some: TuiCurrencyCode = TuiCurrencyCode.HongKong_dollar;
|
20
|
+
|
21
|
+
constructor(
|
22
|
+
@Inject(TuiDirectiveStylesService) private directiveStyles: TuiDirectiveStylesService,
|
23
|
+
) {}
|
24
|
+
|
25
|
+
method() {
|
26
|
+
this.directiveStyles.addComponent(component);
|
27
|
+
}
|
28
|
+
|
29
|
+
method2() {
|
30
|
+
this.directiveStyles.addStyle(styles, 'style');
|
31
|
+
}
|
32
|
+
}`;
|
33
|
+
const AFTER = `import {Component} from '@angular/core';
|
34
|
+
import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce';
|
35
|
+
import {TuiDirectiveStylesService} from '@taiga-ui/cdk';
|
36
|
+
|
37
|
+
const lineType: TuiCurrency = TuiCurrency.HongKongDollar;
|
38
|
+
|
39
|
+
@Component({templateUrl: './app.template.html'})
|
40
|
+
export class AppComponent {
|
41
|
+
some: TuiCurrencyCode = TuiCurrencyCode.HongKongDollar;
|
42
|
+
|
43
|
+
constructor(
|
44
|
+
@Inject(TuiDirectiveStylesService) private directiveStyles: TuiDirectiveStylesService,
|
45
|
+
) {}
|
46
|
+
|
47
|
+
method() {
|
48
|
+
this.directiveStyles.addComponent(component);
|
49
|
+
}
|
50
|
+
|
51
|
+
method2() {
|
52
|
+
// TODO: (Taiga UI migration) addStyle method has been removed. Use components approach
|
53
|
+
this.directiveStyles.addStyle(styles, 'style');
|
54
|
+
}
|
55
|
+
}`;
|
56
|
+
describe(`ng-update miscellaneous`, () => {
|
57
|
+
let host;
|
58
|
+
let runner;
|
59
|
+
beforeEach(() => {
|
60
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
61
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
62
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
63
|
+
createMainFiles();
|
64
|
+
ng_morph_1.saveActiveProject();
|
65
|
+
});
|
66
|
+
it(`should replace content`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
67
|
+
const tree = yield runner
|
68
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
69
|
+
.toPromise();
|
70
|
+
expect(tree.readContent(`test/app/app.component.ts`)).toEqual(AFTER);
|
71
|
+
}));
|
72
|
+
afterEach(() => {
|
73
|
+
ng_morph_1.resetActiveProject();
|
74
|
+
});
|
75
|
+
});
|
76
|
+
function createMainFiles() {
|
77
|
+
ng_morph_1.createSourceFile(`test/app/app.component.ts`, BEFORE);
|
78
|
+
ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
|
79
|
+
create_angular_json_1.createAngularJson();
|
80
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
81
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,157 @@
|
|
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 = `
|
12
|
+
import { Component } from '@angular/core';
|
13
|
+
import {
|
14
|
+
TuiNotificationOptions,
|
15
|
+
TuiNotificationOptionsWithData,
|
16
|
+
AnotherType,
|
17
|
+
TuiAbstractTextfieldHost
|
18
|
+
} from '@taiga-ui/core';
|
19
|
+
import { InputCountOptions } from '@taiga-ui/kit/components';
|
20
|
+
import { ScrollIntoViewDirective, CodeComponent } from '@taiga-ui/addon-doc';
|
21
|
+
import { TableBar } from '@taiga-ui/addon-tablebars';
|
22
|
+
import { TuiInvalidDayException, TuiInvalidMonthException, TuiInvalidYearException } from '@taiga-ui/cdk/exceptions';
|
23
|
+
import { ButtonOptions, some, InputCountOptions, WithDateMaskPipeConfig } from '@taiga-ui/core/types';
|
24
|
+
import { InputPasswordOptions } from '@taiga-ui/kit/components/input-password';
|
25
|
+
import { TUI_INPUT_TIME_OPTIONS, InputTimeOptions, Country, RadioOptions } from '@taiga-ui/kit';
|
26
|
+
import {
|
27
|
+
Language,
|
28
|
+
LanguageCore,
|
29
|
+
LanguageCommerce,
|
30
|
+
LanguageEditor,
|
31
|
+
LanguagePreview,
|
32
|
+
LanguageTable,
|
33
|
+
LanguageKit
|
34
|
+
} from '@taiga-ui/i18n';
|
35
|
+
import { ToggleOptions } from '@taiga-ui/cdk';
|
36
|
+
const options: ButtonOptions = {};
|
37
|
+
const inputCountOptions: InputCountOptions = {};
|
38
|
+
const passwordOptions = {} as InputPasswordOptions;
|
39
|
+
const config: WithDateMaskPipeConfig = {}
|
40
|
+
const notificationOptions: TuiNotificationOptions = {};
|
41
|
+
const notificationOptionsWithData: TuiNotificationOptionsWithData<string> = {};
|
42
|
+
const COUNTRIES: Country[] = [];
|
43
|
+
const language: Language
|
44
|
+
| LanguageCore
|
45
|
+
| LanguageCommerce
|
46
|
+
| LanguageEditor
|
47
|
+
| LanguagePreview
|
48
|
+
| LanguageTable
|
49
|
+
| LanguageKit
|
50
|
+
| null = null;
|
51
|
+
|
52
|
+
@Component({
|
53
|
+
templateUrl: './app.template.html',
|
54
|
+
providers: [
|
55
|
+
{provide: TUI_TOGGLE_OPTIONS, useValue: {showIcons: true} as ToggleOptions},
|
56
|
+
],
|
57
|
+
})
|
58
|
+
export class AppComponent {
|
59
|
+
some: ButtonOptions = {};
|
60
|
+
doSomething(options: InputCountOptions) {
|
61
|
+
console.log(options.step);
|
62
|
+
}
|
63
|
+
get passwordOptions(): InputPasswordOptions {
|
64
|
+
return {};
|
65
|
+
}
|
66
|
+
get radioOptions() {
|
67
|
+
return {size: 'l'} as RadioOptions;
|
68
|
+
}
|
69
|
+
constructor(@Inject(TUI_INPUT_TIME_OPTIONS) readonly options: InputTimeOptions) {}
|
70
|
+
}
|
71
|
+
|
72
|
+
export class Textfield extends TuiAbstractTextfieldHost {}
|
73
|
+
`;
|
74
|
+
const AFTER = `
|
75
|
+
import { Component } from '@angular/core';
|
76
|
+
import { TuiAlertOptions, AnotherType, AbstractTuiTextfieldHost } from '@taiga-ui/core';
|
77
|
+
import { TuiInputCountOptions } from '@taiga-ui/kit';
|
78
|
+
import { TuiScrollIntoViewLinkDirective, TuiCodeComponent } from '@taiga-ui/addon-doc';
|
79
|
+
import { TuiTableBar } from '@taiga-ui/addon-tablebars';
|
80
|
+
import { TuiInvalidDayException, TuiInvalidMonthException, TuiInvalidYearException } from '@taiga-ui/cdk';
|
81
|
+
import { TuiButtonOptions, some, InputCountOptions } from '@taiga-ui/core';
|
82
|
+
import { TuiInputPasswordOptions } from '@taiga-ui/kit';
|
83
|
+
import { TUI_INPUT_TIME_OPTIONS, TuiInputTimeOptions, TuiRadioOptions } from '@taiga-ui/kit';
|
84
|
+
import {
|
85
|
+
TuiLanguage,
|
86
|
+
TuiLanguageCore,
|
87
|
+
TuiLanguageCommerce,
|
88
|
+
TuiLanguageEditor,
|
89
|
+
TuiLanguagePreview,
|
90
|
+
TuiLanguageTable,
|
91
|
+
TuiLanguageKit
|
92
|
+
} from '@taiga-ui/i18n';
|
93
|
+
import { TuiToggleOptions } from '@taiga-ui/cdk';
|
94
|
+
const options: TuiButtonOptions = {};
|
95
|
+
const inputCountOptions: TuiInputCountOptions = {};
|
96
|
+
const passwordOptions = {} as TuiInputPasswordOptions;
|
97
|
+
const config: any = {}
|
98
|
+
const notificationOptions: TuiAlertOptions<any> = {};
|
99
|
+
const notificationOptionsWithData: TuiAlertOptions<string> = {};
|
100
|
+
const COUNTRIES: any[] = [];
|
101
|
+
const language: TuiLanguage
|
102
|
+
| TuiLanguageCore
|
103
|
+
| TuiLanguageCommerce
|
104
|
+
| TuiLanguageEditor
|
105
|
+
| TuiLanguagePreview
|
106
|
+
| TuiLanguageTable
|
107
|
+
| TuiLanguageKit
|
108
|
+
| null = null;
|
109
|
+
|
110
|
+
@Component({
|
111
|
+
templateUrl: './app.template.html',
|
112
|
+
providers: [
|
113
|
+
{provide: TUI_TOGGLE_OPTIONS, useValue: {showIcons: true} as TuiToggleOptions},
|
114
|
+
],
|
115
|
+
})
|
116
|
+
export class AppComponent {
|
117
|
+
some: TuiButtonOptions = {};
|
118
|
+
doSomething(options: TuiInputCountOptions) {
|
119
|
+
console.log(options.step);
|
120
|
+
}
|
121
|
+
get passwordOptions(): TuiInputPasswordOptions {
|
122
|
+
return {};
|
123
|
+
}
|
124
|
+
get radioOptions() {
|
125
|
+
return {size: 'l'} as TuiRadioOptions;
|
126
|
+
}
|
127
|
+
constructor(@Inject(TUI_INPUT_TIME_OPTIONS) readonly options: TuiInputTimeOptions) {}
|
128
|
+
}
|
129
|
+
|
130
|
+
export class Textfield extends AbstractTuiTextfieldHost {}
|
131
|
+
`;
|
132
|
+
describe(`ng-update`, () => {
|
133
|
+
let host;
|
134
|
+
let runner;
|
135
|
+
beforeEach(() => {
|
136
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
137
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
138
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
139
|
+
createMainFiles();
|
140
|
+
ng_morph_1.saveActiveProject();
|
141
|
+
});
|
142
|
+
it(`should rename types`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
143
|
+
const tree = yield runner
|
144
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
145
|
+
.toPromise();
|
146
|
+
expect(tree.readContent(`test/app/app.component.ts`)).toEqual(AFTER);
|
147
|
+
}));
|
148
|
+
afterEach(() => {
|
149
|
+
ng_morph_1.resetActiveProject();
|
150
|
+
});
|
151
|
+
});
|
152
|
+
function createMainFiles() {
|
153
|
+
ng_morph_1.createSourceFile(`test/app/app.component.ts`, BEFORE);
|
154
|
+
ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
|
155
|
+
create_angular_json_1.createAngularJson();
|
156
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
157
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,135 @@
|
|
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 AFTER = `import { TuiTableCommands } from "@taiga-ui/addon-editor";
|
12
|
+
import { TuiCountryIsoCode } from "@taiga-ui/i18n";
|
13
|
+
import { identity } from "rxjs";
|
14
|
+
import { TuiAlertModule } from "@taiga-ui/core";
|
15
|
+
import { Validators } from "@angular/forms";
|
16
|
+
import {Component} from '@angular/core';
|
17
|
+
import { tuiCreateAutoCorrectedDatePipe, tuiCreateDateMask, tuiCreateDateRangeMask } from '@taiga-ui/kit';
|
18
|
+
import { tuiGetClosestFocusable, AbstractTuiController } from '@taiga-ui/cdk';
|
19
|
+
|
20
|
+
@Component({templateUrl: './app.template.html'})
|
21
|
+
export class AppComponent extends AbstractTuiController {
|
22
|
+
private readonly textMaskOptions = {
|
23
|
+
mask: tuiCreateDateMask('DMY', '.'),
|
24
|
+
pipe: tuiCreateAutoCorrectedDatePipe(this),
|
25
|
+
guide: false,
|
26
|
+
};
|
27
|
+
|
28
|
+
mask = tuiCreateDateRangeMask('DMY', '.');
|
29
|
+
|
30
|
+
command = TuiTableCommands.InsertColumnBefore;
|
31
|
+
|
32
|
+
control = new FormControl('', [Validators.nullValidator]);
|
33
|
+
|
34
|
+
onMouseDown(event: MouseEvent, target: HTMLElement) {
|
35
|
+
if (tuiGetClosestFocusable({initial: target, root: 'button', previous: false, keyboard: true})) {
|
36
|
+
return null;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
@NgModule({
|
42
|
+
imports: [
|
43
|
+
TuiAlertModule
|
44
|
+
],
|
45
|
+
declarations: [AppComponent],
|
46
|
+
})
|
47
|
+
export class TuiTestModule {}
|
48
|
+
|
49
|
+
|
50
|
+
const countriesVariants: ReadonlyArray<readonly TuiCountryIsoCode[]> = [
|
51
|
+
[
|
52
|
+
TuiCountryIsoCode.RU,
|
53
|
+
TuiCountryIsoCode.KZ,
|
54
|
+
TuiCountryIsoCode.UA,
|
55
|
+
TuiCountryIsoCode.BY,
|
56
|
+
],
|
57
|
+
Object.values(TuiCountryIsoCode),
|
58
|
+
];
|
59
|
+
`;
|
60
|
+
const BEFORE = `import {Component} from '@angular/core';
|
61
|
+
import {TUI_DATE_MASK, TUI_DATE_RANGE_MASK, TuiCountryIsoCode, tuiCreateAutoCorrectedDatePipe} from '@taiga-ui/kit';
|
62
|
+
import {EMPTY_VALIDATOR} from '@taiga-ui/cdk';
|
63
|
+
import { TuiController } from '@taiga-ui/cdk';
|
64
|
+
import { tuiGetClosestFocusable, identity } from '@taiga-ui/cdk';
|
65
|
+
import { TuiNotificationsModule } from '@taiga-ui/core';
|
66
|
+
import { TableComands } from '@taiga-ui/addon-editor';
|
67
|
+
import {TuiResizableColumnModule} from '@taiga-ui/addon-table';
|
68
|
+
|
69
|
+
@Component({templateUrl: './app.template.html'})
|
70
|
+
export class AppComponent extends TuiController {
|
71
|
+
private readonly textMaskOptions = {
|
72
|
+
mask: TUI_DATE_MASK,
|
73
|
+
pipe: tuiCreateAutoCorrectedDatePipe(this),
|
74
|
+
guide: false,
|
75
|
+
};
|
76
|
+
|
77
|
+
mask = TUI_DATE_RANGE_MASK;
|
78
|
+
|
79
|
+
command = TableComands.InsertColumnBefore;
|
80
|
+
|
81
|
+
control = new FormControl('', [EMPTY_VALIDATOR]);
|
82
|
+
|
83
|
+
onMouseDown(event: MouseEvent, target: HTMLElement) {
|
84
|
+
if (tuiGetClosestFocusable(target, false, 'button')) {
|
85
|
+
return null;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
@NgModule({
|
91
|
+
imports: [
|
92
|
+
TuiNotificationsModule,
|
93
|
+
TuiResizableColumnModule
|
94
|
+
],
|
95
|
+
declarations: [AppComponent],
|
96
|
+
})
|
97
|
+
export class TuiTestModule {}
|
98
|
+
|
99
|
+
|
100
|
+
const countriesVariants: ReadonlyArray<readonly TuiCountryIsoCode[]> = [
|
101
|
+
[
|
102
|
+
TuiCountryIsoCode.RU,
|
103
|
+
TuiCountryIsoCode.KZ,
|
104
|
+
TuiCountryIsoCode.UA,
|
105
|
+
TuiCountryIsoCode.BY,
|
106
|
+
],
|
107
|
+
Object.values(TuiCountryIsoCode),
|
108
|
+
];
|
109
|
+
`;
|
110
|
+
describe(`ng-update`, () => {
|
111
|
+
let host;
|
112
|
+
let runner;
|
113
|
+
beforeEach(() => {
|
114
|
+
host = new testing_1.UnitTestTree(new schematics_1.HostTree());
|
115
|
+
runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
|
116
|
+
ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
|
117
|
+
createMainFiles();
|
118
|
+
ng_morph_1.saveActiveProject();
|
119
|
+
});
|
120
|
+
it(`should replace constants`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
121
|
+
const tree = yield runner
|
122
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
123
|
+
.toPromise();
|
124
|
+
expect(tree.readContent(`test/app/app.component.ts`)).toEqual(AFTER);
|
125
|
+
}));
|
126
|
+
afterEach(() => {
|
127
|
+
ng_morph_1.resetActiveProject();
|
128
|
+
});
|
129
|
+
});
|
130
|
+
function createMainFiles() {
|
131
|
+
ng_morph_1.createSourceFile(`test/app/app.component.ts`, BEFORE);
|
132
|
+
ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
|
133
|
+
create_angular_json_1.createAngularJson();
|
134
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
135
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,53 @@
|
|
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 replace_styles_1 = require("../steps/replace-styles");
|
11
|
+
const collectionPath = path_1.join(__dirname, `../../../migration.json`);
|
12
|
+
describe(`ng-update`, () => {
|
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
|
+
createMainFiles();
|
20
|
+
ng_morph_1.saveActiveProject();
|
21
|
+
});
|
22
|
+
it(`should rename types`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const tree = yield runner
|
24
|
+
.runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
|
25
|
+
.toPromise();
|
26
|
+
expect(tree.readContent(`test/app/app.component.ts`)).toEqual(`import { Component } from '@angular/core';
|
27
|
+
import { some } from '@taiga-ui/kit';
|
28
|
+
import { any } from '@taiga-ui/cdk'
|
29
|
+
import { unknown } from '@taiga-ui/core'
|
30
|
+
|
31
|
+
@Component({templateUrl: './app.template.html'})
|
32
|
+
export class AppComponent {}`);
|
33
|
+
expect(tree.readContent(`test/style.less`)).toEqual(`${replace_styles_1.TUI_WARNING_NORMALIZE}\n@import '@taiga-ui/styles/taiga-ui-global.less';`);
|
34
|
+
expect(tree.readContent(`test/app/app.template.less`)).toEqual(`@import '@taiga-ui/core/styles/taiga-ui-local.less';`);
|
35
|
+
}));
|
36
|
+
afterEach(() => {
|
37
|
+
ng_morph_1.resetActiveProject();
|
38
|
+
});
|
39
|
+
});
|
40
|
+
function createMainFiles() {
|
41
|
+
ng_morph_1.createSourceFile(`test/app/app.component.ts`, `import { Component } from '@angular/core';
|
42
|
+
import { some } from '@taiga-ui/kit/types';
|
43
|
+
import { any } from '@taiga-ui/cdk/directives/any'
|
44
|
+
import { unknown } from '@taiga-ui/core'
|
45
|
+
|
46
|
+
@Component({templateUrl: './app.template.html'})
|
47
|
+
export class AppComponent {}`);
|
48
|
+
ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
|
49
|
+
ng_morph_1.createSourceFile(`test/style.less`, `@import '~@taiga-ui/core/styles/taiga-ui-global';`);
|
50
|
+
ng_morph_1.createSourceFile(`test/app/app.template.less`, `@import '~@taiga-ui/core/styles/taiga-ui-local';`);
|
51
|
+
create_angular_json_1.createAngularJson();
|
52
|
+
ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
|
53
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|