Skip to content

Commit a620748

Browse files
committed
feat:(upgrade) ngcli16 and ng2.1
1 parent c142636 commit a620748

40 files changed

+251
-334
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# IDEs and editors
1212
/.idea
13+
/.vscode
1314
.project
1415
.classpath
1516
*.launch

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# angular2-multi-component-dynamic-form
22

3-
A small playground using Angular2 RC1 which demonstrates a way to structure an application with a large dynamic form. There is routing so a form can be in multiple steps but the central form object in form of a service is persisted through the app. There are validations (default and custom) + additional customizations that might be needed and several other features.
3+
A small playground using Angular2 which demonstrates a way to structure an application with a large dynamic form. There is routing so a form can be in multiple steps but the central form object in form of a service is persisted through the app. There are validations (default and custom) + additional customizations that might be needed and several other features.
44

55
## Functionality
66

7-
- [x] **RC5 ready!**
7+
- [x] **Angular 2.1 ready!**
88
- [x] Dynamic rendering and customising for form fields
99
- [x] Support for Text, Select, Radio and Checkboxes
1010
- [x] Large form broken over multiple components
@@ -14,10 +14,11 @@ A small playground using Angular2 RC1 which demonstrates a way to structure an a
1414
- [x] Sidebar showing status of form in each component
1515
- [x] Field visibility dependant on service
1616
- [x] Control visibility using specific fields (via custom code in Compontent)
17-
- [x] IE9 Support (with some hacks) [pending testing post RC5 update]
17+
- [x] IE9 Support (with some hacks) [pending testing post 2.1 final update]
1818
- [x] Clicking on text fields should empty them, if empty on blur restore the value
1919
- [x] Tooltips on input fields
2020
- [x] Upgrade to new forms module (RC5)
21+
- [x] Upgrade to AngularCLI Webpack
2122
- [ ] Injecting custom html blocks (non-form related) into components (ads, widgets etc)
2223
- [ ] Highcharts integration
2324
- [ ] Testing large forms (adding as we go along)

angular-cli-build.js

-23
This file was deleted.

angular-cli.json

+23-11
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
{
22
"project": {
3-
"version": "1.0.0-beta.10",
4-
"name": "angular2-multicomponent-form"
3+
"version": "1.0.0-beta.17",
4+
"name": "component-migration"
55
},
66
"apps": [
77
{
8-
"main": "src/main.ts",
9-
"tsconfig": "src/tsconfig.json",
10-
"mobile": false
8+
"root": "src",
9+
"outDir": "dist",
10+
"assets": "assets",
11+
"index": "index.html",
12+
"main": "main.ts",
13+
"test": "test.ts",
14+
"tsconfig": "tsconfig.json",
15+
"prefix": "app",
16+
"mobile": false,
17+
"styles": [
18+
"styles.css"
19+
],
20+
"scripts": [],
21+
"environments": {
22+
"source": "environments/environment.ts",
23+
"dev": "environments/environment.ts",
24+
"prod": "environments/environment.prod.ts"
25+
}
1126
}
1227
],
1328
"addons": [],
1429
"packages": [],
1530
"e2e": {
1631
"protractor": {
17-
"config": "config/protractor.conf.js"
32+
"config": "./protractor.conf.js"
1833
}
1934
},
2035
"test": {
2136
"karma": {
22-
"config": "config/karma.conf.js"
37+
"config": "./karma.conf.js"
2338
}
2439
},
2540
"defaults": {
26-
"prefix": "app",
27-
"sourceDir": "src",
2841
"styleExt": "css",
29-
"prefixInterfaces": false,
30-
"lazyRoutePrefix": "+"
42+
"prefixInterfaces": false
3143
}
3244
}

config/environment.js

-13
This file was deleted.

config/karma-test-shim.js

-56
This file was deleted.

config/karma.conf.js

-45
This file was deleted.

e2e/app.e2e-spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { AppPage } from './app.po';
1+
import { ComponentMigrationPage } from './app.po';
22

3-
describe('angular2-multicomponent-form App Tests: ', function() {
4-
let page: AppPage;
3+
describe('component-migration App', function() {
4+
let page: ComponentMigrationPage;
55

66
beforeEach(() => {
7-
page = new AppPage();
7+
page = new ComponentMigrationPage();
88
});
99

10-
it('should display message saying \'Angular2 Multi Component Dynamic Form demo\'', () => {
10+
it('should display message saying app works', () => {
1111
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('Angular2 Multi Component Dynamic Form demo');
12+
expect(page.getParagraphText()).toEqual('app works!');
1313
});
1414
});

e2e/app.po.ts

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
export class AppPage {
2-
waitTime: number = 3000;
1+
import { browser, element, by } from 'protractor';
32

4-
navigateTo(route: string = '/#/') {
5-
browser.get(route);
6-
this.waitForPageToLoad();
7-
return;
3+
export class ComponentMigrationPage {
4+
navigateTo() {
5+
return browser.get('/');
86
}
97

108
getParagraphText() {
11-
return element(by.css('app-root h3')).getText();
9+
return element(by.css('app-root h1')).getText();
1210
}
13-
14-
waitForPageToLoad() {
15-
browser.wait(() => {
16-
return element(by.css('app-root')).getText().then((text) => {
17-
return text !== 'Loading...';
18-
});
19-
}, this.waitTime);
20-
}
21-
2211
}

e2e/e2e/app.e2e-spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { AppPage } from './app.po';
2+
3+
describe('angular2-multicomponent-form App Tests: ', function() {
4+
let page: AppPage;
5+
6+
beforeEach(() => {
7+
page = new AppPage();
8+
});
9+
10+
it('should display message saying \'Angular2 Multi Component Dynamic Form demo\'', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('Angular2 Multi Component Dynamic Form demo');
13+
});
14+
});

e2e/e2e/app.po.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export class AppPage {
2+
waitTime: number = 3000;
3+
4+
navigateTo(route: string = '/#/') {
5+
browser.get(route);
6+
this.waitForPageToLoad();
7+
return;
8+
}
9+
10+
getParagraphText() {
11+
return element(by.css('app-root h3')).getText();
12+
}
13+
14+
waitForPageToLoad() {
15+
browser.wait(() => {
16+
return element(by.css('app-root')).getText().then((text) => {
17+
return text !== 'Loading...';
18+
});
19+
}, this.waitTime);
20+
}
21+
22+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

e2e/e2e/tsconfig.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"declaration": false,
5+
"emitDecoratorMetadata": true,
6+
"experimentalDecorators": true,
7+
"mapRoot": "",
8+
"module": "commonjs",
9+
"moduleResolution": "node",
10+
"noEmitOnError": true,
11+
"noImplicitAny": false,
12+
"rootDir": ".",
13+
"sourceMap": true,
14+
"sourceRoot": "/",
15+
"target": "es5"
16+
}
17+
}
File renamed without changes.

e2e/tsconfig.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
"declaration": false,
55
"emitDecoratorMetadata": true,
66
"experimentalDecorators": true,
7-
"mapRoot": "",
87
"module": "commonjs",
98
"moduleResolution": "node",
10-
"noEmitOnError": true,
11-
"noImplicitAny": false,
12-
"rootDir": ".",
9+
"outDir": "../dist/out-tsc-e2e",
1310
"sourceMap": true,
14-
"sourceRoot": "/",
15-
"target": "es5"
11+
"target": "es5",
12+
"typeRoots": [
13+
"../node_modules/@types"
14+
]
1615
}
1716
}

karma.conf.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', 'angular-cli'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-remap-istanbul'),
12+
require('angular-cli/plugins/karma')
13+
],
14+
files: [
15+
{ pattern: './src/test.ts', watched: false }
16+
],
17+
preprocessors: {
18+
'./src/test.ts': ['angular-cli']
19+
},
20+
remapIstanbulReporter: {
21+
reports: {
22+
html: 'coverage',
23+
lcovonly: './coverage/coverage.lcov'
24+
}
25+
},
26+
angularCli: {
27+
config: './angular-cli.json',
28+
environment: 'dev'
29+
},
30+
reporters: ['progress', 'karma-remap-istanbul'],
31+
port: 9876,
32+
colors: true,
33+
logLevel: config.LOG_INFO,
34+
autoWatch: true,
35+
browsers: ['Chrome'],
36+
singleRun: false
37+
});
38+
};

0 commit comments

Comments
 (0)