Skip to content

Commit 1781551

Browse files
Add an Angular solution
1 parent 6a110b6 commit 1781551

37 files changed

+1205
-0
lines changed

Angular/.browserslistrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

Angular/.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

Angular/.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
9+
10+
# dependencies
11+
/node_modules
12+
13+
# profiling files
14+
chrome-profiler-events*.json
15+
speed-measure-plugin*.json
16+
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
26+
# IDE - VSCode
27+
.vscode/*
28+
!.vscode/settings.json
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
31+
!.vscode/extensions.json
32+
.history/*
33+
34+
# misc
35+
/.sass-cache
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
npm-debug.log
40+
yarn-error.log
41+
testem.log
42+
/typings
43+
44+
# System Files
45+
.DS_Store
46+
Thumbs.db

Angular/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Angular
2+
3+
Take a look at the following files of this example to see the required code:
4+
5+
- app.component.html
6+
- app.component.ts
7+
- column.chooser.component.html
8+
- column.chooser.component.ts
9+
10+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli).
11+
12+
## Development server
13+
14+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
15+
16+
## Build
17+
18+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
19+
20+
## Further help
21+
22+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
23+
24+
To get more help on DevExtreme submit an issue on [GitHub](https://github.com/DevExpress/devextreme/issues) or [Support Center](https://www.devexpress.com/Support/Center/Question/Create)

Angular/angular.json

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"sample-application": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"style": "scss"
11+
}
12+
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"allowedCommonJsDependencies": [
21+
"devextreme",
22+
"devextreme-angular"
23+
],
24+
"outputPath": "dist/sample-application",
25+
"index": "src/index.html",
26+
"main": "src/main.ts",
27+
"polyfills": "src/polyfills.ts",
28+
"tsConfig": "tsconfig.app.json",
29+
"aot": true,
30+
"assets": [
31+
"src/favicon.ico",
32+
"src/assets"
33+
],
34+
"styles": [
35+
"node_modules/devextreme/dist/css/dx.common.css",
36+
"node_modules/devextreme/dist/css/dx.light.css",
37+
"src/styles.scss"
38+
],
39+
"scripts": []
40+
},
41+
"configurations": {
42+
"production": {
43+
"fileReplacements": [
44+
{
45+
"replace": "src/environments/environment.ts",
46+
"with": "src/environments/environment.prod.ts"
47+
}
48+
],
49+
"optimization": true,
50+
"outputHashing": "all",
51+
"sourceMap": false,
52+
"namedChunks": false,
53+
"extractLicenses": true,
54+
"vendorChunk": false,
55+
"buildOptimizer": true,
56+
"budgets": [
57+
{
58+
"type": "initial",
59+
"maximumWarning": "2mb",
60+
"maximumError": "5mb"
61+
},
62+
{
63+
"type": "anyComponentStyle",
64+
"maximumWarning": "6kb",
65+
"maximumError": "10kb"
66+
}
67+
]
68+
}
69+
}
70+
},
71+
"serve": {
72+
"builder": "@angular-devkit/build-angular:dev-server",
73+
"options": {
74+
"browserTarget": "sample-application:build"
75+
},
76+
"configurations": {
77+
"production": {
78+
"browserTarget": "sample-application:build:production"
79+
}
80+
}
81+
},
82+
"extract-i18n": {
83+
"builder": "@angular-devkit/build-angular:extract-i18n",
84+
"options": {
85+
"browserTarget": "sample-application:build"
86+
}
87+
},
88+
"test": {
89+
"builder": "@angular-devkit/build-angular:karma",
90+
"options": {
91+
"main": "src/test.ts",
92+
"polyfills": "src/polyfills.ts",
93+
"tsConfig": "tsconfig.spec.json",
94+
"karmaConfig": "karma.conf.js",
95+
"assets": [
96+
"src/favicon.ico",
97+
"src/assets"
98+
],
99+
"styles": [
100+
"src/styles.scss"
101+
],
102+
"scripts": []
103+
}
104+
},
105+
"lint": {
106+
"builder": "@angular-devkit/build-angular:tslint",
107+
"options": {
108+
"tsConfig": [
109+
"tsconfig.app.json",
110+
"tsconfig.spec.json",
111+
"e2e/tsconfig.json"
112+
],
113+
"exclude": [
114+
"**/node_modules/**"
115+
]
116+
}
117+
},
118+
"e2e": {
119+
"builder": "@angular-devkit/build-angular:protractor",
120+
"options": {
121+
"protractorConfig": "e2e/protractor.conf.js",
122+
"devServerTarget": "sample-application:serve"
123+
},
124+
"configurations": {
125+
"production": {
126+
"devServerTarget": "sample-application:serve:production"
127+
}
128+
}
129+
}
130+
}
131+
}
132+
},
133+
"defaultProject": "sample-application"
134+
}

Angular/e2e/protractor.conf.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// @ts-check
2+
// Protractor configuration file, see link for more information
3+
// https://github.com/angular/protractor/blob/master/lib/config.ts
4+
5+
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
6+
7+
/**
8+
* @type { import("protractor").Config }
9+
*/
10+
exports.config = {
11+
allScriptsTimeout: 11000,
12+
specs: [
13+
'./src/**/*.e2e-spec.ts'
14+
],
15+
capabilities: {
16+
browserName: 'chrome'
17+
},
18+
directConnect: true,
19+
SELENIUM_PROMISE_MANAGER: false,
20+
baseUrl: 'http://localhost:4200/',
21+
framework: 'jasmine',
22+
jasmineNodeOpts: {
23+
showColors: true,
24+
defaultTimeoutInterval: 30000,
25+
print: function() {}
26+
},
27+
onPrepare() {
28+
require('ts-node').register({
29+
project: require('path').join(__dirname, './tsconfig.json')
30+
});
31+
jasmine.getEnv().addReporter(new SpecReporter({
32+
spec: {
33+
displayStacktrace: StacktraceOption.PRETTY
34+
}
35+
}));
36+
}
37+
};

Angular/e2e/src/app.e2e-spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { AppPage } from './app.po';
2+
import { browser, logging } from 'protractor';
3+
4+
describe('workspace-project App', () => {
5+
let page: AppPage;
6+
7+
beforeEach(() => {
8+
page = new AppPage();
9+
});
10+
11+
it('should display welcome message', async () => {
12+
await page.navigateTo();
13+
expect(await page.getTitleText()).toEqual('sample-application app is running!');
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19+
expect(logs).not.toContain(jasmine.objectContaining({
20+
level: logging.Level.SEVERE,
21+
} as logging.Entry));
22+
});
23+
});

Angular/e2e/src/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, by, element } from 'protractor';
2+
3+
export class AppPage {
4+
async navigateTo(): Promise<unknown> {
5+
return browser.get(browser.baseUrl);
6+
}
7+
8+
async getTitleText(): Promise<string> {
9+
return element(by.css('app-root .content span')).getText();
10+
}
11+
}

Angular/e2e/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "../tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "../out-tsc/e2e",
6+
"module": "commonjs",
7+
"target": "es2018",
8+
"types": [
9+
"jasmine",
10+
"node"
11+
]
12+
}
13+
}

Angular/karma.conf.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, './coverage/sample-application'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: true,
40+
browsers: ['Chrome'],
41+
singleRun: false,
42+
restartOnFileChange: true
43+
});
44+
};

0 commit comments

Comments
 (0)