From 37a19a3fbbf201c2b671239a8a3c21f7a6a65f24 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 21 Dec 2016 17:11:19 +0100 Subject: [PATCH 1/7] added postcss --- package.json | 15 +++++++++------ postcss.config.json | 9 +++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 postcss.config.json diff --git a/package.json b/package.json index 520f7b3677..f2cb71159d 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,16 @@ "clean:prod": "npm run clean:ngc && npm run clean:json && npm run clean:css && npm run clean:css:ts && npm run clean:scss:ts && npm run clean:css:shim:ts && npm run clean:scss:shim:ts && npm run clean:dist", "clean": "npm run clean:log && npm run clean:prod && npm run clean:node", "sass": "node-sass src -o src --include-path node_modules --output-style compressed -q", - "sass:watch": "node-sass -w src -o src --include-path node_modules --output-style compressed -q", + "postcss": "postcss -c postcss.config.json", + "style": "npm run sass && npm run postcss", + "style:watch": "nodemon -e scss -w src -x \"npm run style\"", "rollup": "rollup -c rollup-server.js && rollup -c rollup-client.js", - "prebuild": "npm run clean:dist && npm run sass", + "prebuild": "npm run clean:dist && npm run style", "build": "webpack --progress", "build:prod": "webpack --config webpack.prod.config.ts", "build:prod:rollup": "npm run build:prod && npm run rollup", - "build:prod:ngc": "npm run clean:prod && npm run sass && npm run ngc && npm run build:prod:rollup", - "build:prod:ngc:json": "npm run clean:prod && npm run sass && npm run ngc && npm run build:prod:json:rollup", + "build:prod:ngc": "npm run clean:prod && npm run style && npm run ngc && npm run build:prod:rollup", + "build:prod:ngc:json": "npm run clean:prod && npm run style && npm run ngc && npm run build:prod:json:rollup", "build:prod:json": "webpack --config webpack.prod.config.ts --json | webpack-bundle-size-analyzer", "build:prod:json:rollup": "npm run build:prod:json && npm run rollup", "ngc": "ngc -p tsconfig.aot.json", @@ -36,7 +38,7 @@ "server:dev": "nodemon --debug dist/server/index.js", "start": "npm run server", "start:dev": "npm run clean:prod && npm run build && npm run server", - "watch": "webpack -w & npm run sass:watch", + "watch": "webpack -w & npm run style:watch", "watch:dev:server": "concurrently \"npm run server:dev\" \"npm run watch\"", "watch:dev": "npm run clean:prod && npm run build && npm run watch:dev:server", "watch:prod:server": "concurrently \"npm run server\" \"npm run watch\"", @@ -49,7 +51,7 @@ "debug:build:prod": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js --config webpack.prod.config.ts", "docs": "typedoc --options typedoc.json ./src", "lint": "tslint \"src/**/*.ts\" || true", - "global": "npm install -g angular-cli nodemon npm-check-updates rimraf ts-node typedoc typescript webpack webpack-bundle-size-analyzer rollup marked node-gyp" + "global": "npm install -g angular-cli nodemon npm-check-updates rimraf ts-node typedoc typescript webpack webpack-bundle-size-analyzer rollup marked node-gyp postcss-cli" }, "dependencies": { "@angular/common": "2.2.3", @@ -75,6 +77,7 @@ "angular2-platform-node": "2.1.0-rc.1", "angular2-universal": "2.1.0-rc.1", "angular2-universal-polyfills": "2.1.0-rc.1", + "autoprefixer": "^6.5.4", "body-parser": "1.15.2", "bootstrap": "4.0.0-alpha.5", "compression": "1.6.2", diff --git a/postcss.config.json b/postcss.config.json new file mode 100644 index 0000000000..70df875975 --- /dev/null +++ b/postcss.config.json @@ -0,0 +1,9 @@ +{ + "use": ["autoprefixer"], + "input": "src/**/*.css", + "replace": true, + "local-plugins": true, + "autoprefixer": { + "browsers": "last 2 versions" + } +} From 376255700b12a6caae86c273a7bf1f6286698abb Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 21 Dec 2016 17:50:20 +0100 Subject: [PATCH 2/7] added entry to file structure --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a7b658b5c4..74e9ef1e2d 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ dspace-angular ├── app.json * Application manifest file ├── nodemon.json * Nodemon (https://nodemon.io/) configuration ├── package.json * This file describes the npm package for this project, its dependencies, scripts, etc. +├── postcss.config.json * PostCSS (http://postcss.org/) configuration file ├── resources * Folder for static resources │   ├── i18n * Folder for i18n translations │   └── images * Folder for images From 28fd92b9f7fdf8fd0ae6f937a979344960896a13 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Fri, 13 Jan 2017 18:37:35 +0100 Subject: [PATCH 3/7] test issue --- src/app/app.component.spec.ts | 19 +++++-- src/test-issue.spec.ts | 97 +++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 src/test-issue.spec.ts diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 4f53b0ba93..64e45e9bfb 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -9,6 +9,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from "@angular/core"; +import { By } from '@angular/platform-browser'; import { TranslateModule } from "ng2-translate"; import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap'; import { Store } from "@ngrx/store"; @@ -28,7 +29,7 @@ let el: HTMLElement; describe('App component', () => { - beforeEach(() => { + beforeEach(async(() => { return TestBed.configureTestingModule({ imports: [ CommonModule, TranslateModule.forRoot(), NgbCollapseModule.forRoot()], declarations: [ AppComponent, HeaderComponent ], // declare the test component @@ -40,10 +41,18 @@ describe('App component', () => { } ], schemas: [ CUSTOM_ELEMENTS_SCHEMA ] - }).compileComponents().then(() => { - fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - }); + }) + })); + + // synchronous beforeEach + beforeEach(() => { + fixture = TestBed.createComponent(AppComponent); + + comp = fixture.componentInstance; // BannerComponent test instance + + // query for the title

by CSS element selector + de = fixture.debugElement.query(By.css('p')); + el = de.nativeElement; }); it('should create component', inject([AppComponent], (app: AppComponent) => { diff --git a/src/test-issue.spec.ts b/src/test-issue.spec.ts new file mode 100644 index 0000000000..434b928e29 --- /dev/null +++ b/src/test-issue.spec.ts @@ -0,0 +1,97 @@ +import { + async, + ComponentFixture, + inject, + TestBed +} from '@angular/core/testing'; + +describe('test issue', () => { + it('should test 1', () => { + expect(true).toBe(true); + }); + + it('should test 2', () => { + expect(true).toBe(true); + }); + + it('should test 3', () => { + expect(true).toBe(true); + }); + + it('should test 4', () => { + expect(true).toBe(true); + }); + + it('should test 5', () => { + expect(true).toBe(true); + }); + + it('should test 6', () => { + expect(true).toBe(true); + }); + + it('should test 7', () => { + expect(true).toBe(true); + }); + + it('should test 8', () => { + expect(true).toBe(true); + }); + + it('should test 9', () => { + expect(true).toBe(true); + }); + + it('should test 10', () => { + expect(true).toBe(true); + }); + + it('should test 11', () => { + expect(true).toBe(true); + }); + + it('should test 12', () => { + expect(true).toBe(true); + }); + + it('should test 13', () => { + expect(true).toBe(true); + }); + + it('should test 14', () => { + expect(true).toBe(true); + }); + + it('should test 15', () => { + expect(true).toBe(true); + }); + + it('should test 16', () => { + expect(true).toBe(true); + }); + + it('should test 17', () => { + expect(true).toBe(true); + }); + + it('should test 18', () => { + expect(true).toBe(true); + }); + + it('should test 19', () => { + expect(true).toBe(true); + }); + + it('should test 20', () => { + expect(true).toBe(true); + }); + + it('should test 21', () => { + expect(true).toBe(true); + }); + + it('should test 22', () => { + expect(true).toBe(true); + }); + +}); From 3766a4ba85a798f97bc2aa5bfbc74c1732199e90 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Fri, 13 Jan 2017 18:39:24 +0100 Subject: [PATCH 4/7] test issue --- src/app/app.component.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 64e45e9bfb..f457d141e5 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -14,7 +14,6 @@ import { TranslateModule } from "ng2-translate"; import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap'; import { Store } from "@ngrx/store"; - // Load the implementations that should be tested import { AppComponent } from './app.component'; import { HeaderComponent } from './header/header.component'; @@ -26,9 +25,9 @@ let fixture: ComponentFixture; let de: DebugElement; let el: HTMLElement; - describe('App component', () => { + // async beforeEach beforeEach(async(() => { return TestBed.configureTestingModule({ imports: [ CommonModule, TranslateModule.forRoot(), NgbCollapseModule.forRoot()], From bd29e4ad6516369832ed50a0989db9365a6a4246 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Mon, 16 Jan 2017 17:13:45 +0100 Subject: [PATCH 5/7] Delete test-issue.spec.ts --- src/test-issue.spec.ts | 97 ------------------------------------------ 1 file changed, 97 deletions(-) delete mode 100644 src/test-issue.spec.ts diff --git a/src/test-issue.spec.ts b/src/test-issue.spec.ts deleted file mode 100644 index 434b928e29..0000000000 --- a/src/test-issue.spec.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { - async, - ComponentFixture, - inject, - TestBed -} from '@angular/core/testing'; - -describe('test issue', () => { - it('should test 1', () => { - expect(true).toBe(true); - }); - - it('should test 2', () => { - expect(true).toBe(true); - }); - - it('should test 3', () => { - expect(true).toBe(true); - }); - - it('should test 4', () => { - expect(true).toBe(true); - }); - - it('should test 5', () => { - expect(true).toBe(true); - }); - - it('should test 6', () => { - expect(true).toBe(true); - }); - - it('should test 7', () => { - expect(true).toBe(true); - }); - - it('should test 8', () => { - expect(true).toBe(true); - }); - - it('should test 9', () => { - expect(true).toBe(true); - }); - - it('should test 10', () => { - expect(true).toBe(true); - }); - - it('should test 11', () => { - expect(true).toBe(true); - }); - - it('should test 12', () => { - expect(true).toBe(true); - }); - - it('should test 13', () => { - expect(true).toBe(true); - }); - - it('should test 14', () => { - expect(true).toBe(true); - }); - - it('should test 15', () => { - expect(true).toBe(true); - }); - - it('should test 16', () => { - expect(true).toBe(true); - }); - - it('should test 17', () => { - expect(true).toBe(true); - }); - - it('should test 18', () => { - expect(true).toBe(true); - }); - - it('should test 19', () => { - expect(true).toBe(true); - }); - - it('should test 20', () => { - expect(true).toBe(true); - }); - - it('should test 21', () => { - expect(true).toBe(true); - }); - - it('should test 22', () => { - expect(true).toBe(true); - }); - -}); From 37c9b106f2a906e3baeb3b6c0d39bb3920c00cad Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Tue, 17 Jan 2017 11:01:21 +0100 Subject: [PATCH 6/7] removed global dependency on postcss-cli --- package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3643ba7fc2..5e7e4d4c4a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "clean:prod": "npm run clean:ngc && npm run clean:json && npm run clean:css && npm run clean:css:ts && npm run clean:scss:ts && npm run clean:css:shim:ts && npm run clean:scss:shim:ts && npm run clean:dist", "clean": "npm run clean:log && npm run clean:prod && npm run clean:coverage && npm run clean:node", "sass": "node-sass src -o src --include-path node_modules --output-style compressed -q", - "postcss": "postcss -c postcss.config.json", + "postcss": "node_modules/postcss-cli/bin/postcss -c postcss.config.json", "style": "npm run sass && npm run postcss", "style:watch": "nodemon -e scss -w src -x \"npm run style\"", "rollup": "rollup -c rollup-server.js && rollup -c rollup-client.js", @@ -52,7 +52,7 @@ "debug:build:prod": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js --config webpack.prod.config.ts", "docs": "typedoc --options typedoc.json ./src", "lint": "tslint \"src/**/*.ts\" || true", - "global": "npm install -g angular-cli nodemon npm-check-updates rimraf ts-node typedoc typescript webpack webpack-bundle-size-analyzer rollup marked node-gyp postcss-cli", + "global": "npm install -g angular-cli nodemon npm-check-updates rimraf ts-node typedoc typescript webpack webpack-bundle-size-analyzer rollup marked node-gyp", "protractor": "node node_modules/protractor/bin/protractor", "e2e": "npm run protractor", "test": "karma start --single-run", @@ -116,10 +116,10 @@ "@types/node": "6.0.52", "@types/serve-static": "1.7.31", "@types/webfontloader": "1.6.27", - "angular2-template-loader": "0.6.0", - "autoprefixer": "6.5.4", "ajv": "4.2.0", "ajv-keywords": "1.1.1", + "angular2-template-loader": "0.6.0", + "autoprefixer": "6.5.4", "awesome-typescript-loader": "2.2.4", "codelyzer": "2.0.0-beta.3", "concurrently": "3.1.0", @@ -145,6 +145,7 @@ "karma-webpack": "1.8.0", "node-sass": "4.0.0", "nodemon": "1.11.0", + "postcss-cli": "^2.6.0", "protractor": "~4.0.14", "protractor-istanbul-plugin": "~2.0.0", "raw-loader": "0.5.1", From 7947451dd400f9e7d59136a38d6387c19c49285c Mon Sep 17 00:00:00 2001 From: William Welling Date: Tue, 17 Jan 2017 07:58:26 -0600 Subject: [PATCH 7/7] Corrected typo for test command --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2d3d1b602e..8ff0bdfd6e 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ The default browser is Google Chrome. Place your tests in the same location of the application source code files that they test. and run: -`npn run test` +`npm run test` ### E2E test E2E tests use Protractor + Selenium server + browsers. You can find the configuration file at the same level of this README file: @@ -192,7 +192,7 @@ dspace-angular ## 3rd Party Library Installation -Install your library via `npm install lib-name --save` and import it in your code. `--save` will add it to `package.json`. +Install your library via `npm install lib-name --save` and import it in your code. `--save` will add it to `package.json`. If the library does not include typings, you can install them using npm: @@ -228,7 +228,7 @@ import * as _ from 'lodash'; ## Frequently asked questions * Why is my service, aka provider, is not injecting a parameter correctly? - * Please use `@Injectable()` for your service for typescript to correctly attach the metadata + * Please use `@Injectable()` for your service for typescript to correctly attach the metadata * Where do I write my tests? * You can write your tests next to your component files. e.g. for `src/app/home/home.component.ts` call it `src/app/home/home.component.spec.ts` * How do I start the app when I get `EACCES` and `EADDRINUSE` errors?