Skip to content

Commit c26c8ff

Browse files
authored
fix(igx-ts-legacy): update igx ts legacy templates (#1517)
1 parent 70203d6 commit c26c8ff

File tree

318 files changed

+1732
-1806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

318 files changed

+1732
-1806
lines changed

packages/cli/lib/templates/AngularTemplate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class AngularTemplate implements Template {
4545
}
4646

4747
public registerInProject(projectPath: string, name: string, options?: AddTemplateArgs) {
48-
let modulePath = "app.module.ts";
48+
let modulePath = "app-module.ts";
4949
if (options && options.modulePath) {
5050
modulePath = options.modulePath;
5151
}
@@ -63,7 +63,7 @@ export class AngularTemplate implements Template {
6363
//1) import the component class name,
6464
//2) and populate the Routes array with the path and component
6565
//for example: { path: "combo", component: ComboComponent }
66-
const routingModulePath = path.join(projectPath, "src/app/app-routing.module.ts");
66+
const routingModulePath = path.join(projectPath, "src/app/app-routing-module.ts");
6767
const routingModule = new TsUpdate(routingModulePath, false, { singleQuotes: false });
6868

6969
routingModule.addRoute({
@@ -84,7 +84,7 @@ export class AngularTemplate implements Template {
8484
mainModule.addNgModuleMeta({
8585
declare: [className],
8686
from: relativePath,
87-
export: modulePath !== "app.module.ts" ? [className] : []
87+
export: modulePath !== "app-module.ts" ? [className] : []
8888
});
8989
mainModule.finalize();
9090

packages/igx-templates/IgniteUIForAngularTemplate.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class IgniteUIForAngularTemplate implements Template {
5050

5151
//TODO: rename name to fullName for clarity + in all other places fileName to fullName
5252
public registerInProject(projectPath: string, name: string, options?: AddTemplateArgs) {
53-
let modulePath = "app.module.ts";
53+
let modulePath = "app-module.ts";
5454
if (options && options.modulePath) {
5555
modulePath = options.modulePath;
5656
}
@@ -66,8 +66,8 @@ export class IgniteUIForAngularTemplate implements Template {
6666
const mainModulePath = path.join(projectPath, `src/app/${modulePath}`);
6767
const folderName = this.folderName(name);
6868
const fileName = this.fileName(name);
69-
const componentFilePath = path.join(projectPath, `src/app/${folderName}/${fileName}.component.ts`);
70-
const className = `${Util.className(Util.nameFromPath(name))}Component`;
69+
const componentFilePath = path.join(projectPath, `src/app/${folderName}/${fileName}.ts`);
70+
const className = `${Util.className(Util.nameFromPath(name))}`;
7171
// standalone components
7272
if (!this.fileExists(mainModulePath)) {
7373
const appRoutesPath = "src/app/app.routes.ts";
@@ -108,11 +108,11 @@ export class IgniteUIForAngularTemplate implements Template {
108108
}
109109

110110
// ngModule based components
111-
if (!(options && options.skipRoute) && this.fileExists("src/app/app-routing.module.ts")) {
111+
if (!(options && options.skipRoute) && this.fileExists("src/app/app-routing-module.ts")) {
112112
//1) import the component class name,
113113
//2) and populate the Routes array with the path and component
114114
//for example: { path: 'combo', component: ComboComponent }
115-
const routingModulePath = path.join(projectPath, "src/app/app-routing.module.ts");
115+
const routingModulePath = path.join(projectPath, "src/app/app-routing-module.ts");
116116
const routingModule = new TsUpdate(routingModulePath, false, { indentSize: 2, singleQuotes: true });
117117
routingModule.addRoute({
118118
modulePath: Util.relativePath(routingModulePath, componentFilePath, true, true),
@@ -130,7 +130,7 @@ export class IgniteUIForAngularTemplate implements Template {
130130
mainModule.addNgModuleMeta({
131131
declare: this.addAsNgModelDeclaration ? [className] : [],
132132
from: Util.relativePath(mainModulePath, componentFilePath, true, true),
133-
export: modulePath !== "app.module.ts" ? [className] : []
133+
export: modulePath !== "app-module.ts" ? [className] : []
134134
},
135135
Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content),
136136
true // multiline

packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.component.spec.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.component.html renamed to packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.html

File renamed without changes.

packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.component.scss renamed to packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.scss

File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
3+
import { <%=ClassName%> } from './<%=filePrefix%>';
4+
import { IgxAccordionModule, IgxSwitchModule } from '<%=igxPackage%>';
5+
6+
describe('<%=ClassName%>', () => {
7+
let component: <%=ClassName%>;
8+
let fixture: ComponentFixture<<%=ClassName%>>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
declarations: [<%=ClassName%>],
13+
imports: [ NoopAnimationsModule, IgxAccordionModule, IgxSwitchModule ]
14+
})
15+
.compileComponents();
16+
});
17+
18+
beforeEach(() => {
19+
fixture = TestBed.createComponent(<%=ClassName%>);
20+
component = fixture.componentInstance;
21+
fixture.detectChanges();
22+
});
23+
24+
it('should create', () => {
25+
expect(component).toBeTruthy();
26+
});
27+
});

packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.component.ts renamed to packages/igx-templates/igx-ts-legacy/accordion/default/files/src/app/__path__/__filePrefix__.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-<%=filePrefix%>',
5-
templateUrl: './<%=filePrefix%>.component.html',
6-
styleUrls: ['./<%=filePrefix%>.component.scss'],
5+
templateUrl: './<%=filePrefix%>.html',
6+
styleUrl: './<%=filePrefix%>.scss',
77
standalone: false
88
})
9-
export class <%=ClassName%>Component {
9+
export class <%=ClassName%> {
1010
public singleBranchExpand = false;
1111
}

packages/igx-templates/igx-ts-legacy/autocomplete/autocomplete-custom/files/src/app/__path__/__filePrefix__.component.html renamed to packages/igx-templates/igx-ts-legacy/autocomplete/autocomplete-custom/files/src/app/__path__/__filePrefix__.html

File renamed without changes.

packages/igx-templates/igx-ts-legacy/autocomplete/autocomplete-custom/files/src/app/__path__/__filePrefix__.component.scss renamed to packages/igx-templates/igx-ts-legacy/autocomplete/autocomplete-custom/files/src/app/__path__/__filePrefix__.scss

File renamed without changes.

packages/igx-templates/igx-ts-legacy/autocomplete/autocomplete-custom/files/src/app/__path__/__filePrefix__.component.spec.ts renamed to packages/igx-templates/igx-ts-legacy/autocomplete/autocomplete-custom/files/src/app/__path__/__filePrefix__.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { FormsModule } from '@angular/forms';
33
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
44
import { IgxAutocompleteModule, IgxDropDownModule, IgxInputGroupModule } from '<%=igxPackage%>';
5-
import { <%=ClassName%>Component, <%=ClassName%>PipeStartsWith } from './<%=filePrefix%>.component';
5+
import { <%=ClassName%>, <%=ClassName%>PipeStartsWith } from './<%=filePrefix%>';
66

7-
describe('<%=ClassName%>Component', () => {
8-
let component: <%=ClassName%>Component;
9-
let fixture: ComponentFixture<<%=ClassName%>Component>;
7+
describe('<%=ClassName%>', () => {
8+
let component: <%=ClassName%>;
9+
let fixture: ComponentFixture<<%=ClassName%>>;
1010

11-
beforeEach(waitForAsync(() => {
12-
TestBed.configureTestingModule({
13-
declarations: [<%=ClassName%>Component, <%=ClassName%>PipeStartsWith],
11+
beforeEach(async () => {
12+
await TestBed.configureTestingModule({
13+
declarations: [<%=ClassName%>, <%=ClassName%>PipeStartsWith],
1414
imports: [FormsModule, IgxDropDownModule, IgxAutocompleteModule, NoopAnimationsModule, IgxInputGroupModule]
1515
})
1616
.compileComponents();
17-
}));
17+
});
1818

1919
beforeEach(() => {
20-
fixture = TestBed.createComponent(<%=ClassName%>Component);
20+
fixture = TestBed.createComponent(<%=ClassName%>);
2121
component = fixture.componentInstance;
2222
fixture.detectChanges();
2323
});

0 commit comments

Comments
 (0)