Skip to content

Commit

Permalink
Add code for Shopping Cart
Browse files Browse the repository at this point in the history
  • Loading branch information
swarup4 committed Mar 12, 2021
1 parent 98cd41e commit 0cc60a2
Show file tree
Hide file tree
Showing 100 changed files with 14,371 additions and 7,095 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion _theming.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ $mat-grey: (
800: #424242,
900: #212121,
A100: #ffffff,
A200: #eeeeee,
A200: #3c4252,
A400: #bdbdbd,
A700: #616161,
contrast: (
Expand Down
17 changes: 17 additions & 0 deletions cart/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
3 changes: 3 additions & 0 deletions cart/.editorconfig
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
4 changes: 2 additions & 2 deletions cart/.gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
/node_modules

# profiling files
chrome-profiler-events.json
speed-measure-plugin.json
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
Expand Down
4 changes: 2 additions & 2 deletions cart/README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cart

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.4.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.4.

## Development server

Expand All @@ -24,4 +24,4 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac

## Further help

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).
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
62 changes: 26 additions & 36 deletions cart/angular.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"newProjectRoot": "projects",
"projects": {
"cart": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"style": "sass"
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
Expand All @@ -21,17 +21,18 @@
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
"src/styles.scss",
"src/my-theme.scss"
],
"scripts": [],
"es5BrowserSupport": true
"scripts": []
},
"configurations": {
"production": {
Expand All @@ -44,9 +45,7 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand All @@ -55,6 +54,11 @@
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
Expand Down Expand Up @@ -82,37 +86,32 @@
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
]
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"cart-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
Expand All @@ -124,18 +123,9 @@
"devServerTarget": "cart:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "cart"
}
}
17 changes: 13 additions & 4 deletions cart/e2e/protractor.conf.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');

/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
browserName: 'chrome'
},
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
Expand All @@ -21,8 +26,12 @@ exports.config = {
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};
8 changes: 4 additions & 4 deletions cart/e2e/src/app.e2e-spec.ts
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
import { AppPage } from './app.po';

describe('workspace-project App', () => {
let page: AppPage;
Expand All @@ -8,9 +8,9 @@ describe('workspace-project App', () => {
page = new AppPage();
});

it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to cart!');
it('should display welcome message', async () => {
await page.navigateTo();
expect(await page.getTitleText()).toEqual('cart app is running!');
});

afterEach(async () => {
Expand Down
8 changes: 4 additions & 4 deletions cart/e2e/src/app.po.ts
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { browser, by, element } from 'protractor';

export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
async navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl);
}

getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
async getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText();
}
}
8 changes: 4 additions & 4 deletions cart/e2e/tsconfig.e2e.json → cart/e2e/tsconfig.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
}
22 changes: 17 additions & 5 deletions cart/src/karma.conf.js → cart/karma.conf.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,28 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/cart'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/cart'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
Expand Down

0 comments on commit 0cc60a2

Please sign in to comment.