diff --git a/angular.json b/angular.json index e6500e0..c804805 100644 --- a/angular.json +++ b/angular.json @@ -353,6 +353,118 @@ } } } + }, + "simple-demo": { + "projectType": "application", + "schematics": {}, + "root": "apps/simple-demo", + "sourceRoot": "apps/simple-demo/src", + "prefix": "xng", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/apps/simple-demo", + "index": "apps/simple-demo/src/index.html", + "main": "apps/simple-demo/src/main.ts", + "polyfills": "apps/simple-demo/src/polyfills.ts", + "tsConfig": "apps/simple-demo/tsconfig.app.json", + "aot": true, + "assets": [ + "apps/simple-demo/src/favicon.ico", + "apps/simple-demo/src/assets" + ], + "styles": ["apps/simple-demo/src/styles.css"], + "scripts": [] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "apps/simple-demo/src/environments/environment.ts", + "with": "apps/simple-demo/src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "simple-demo:build" + }, + "configurations": { + "production": { + "browserTarget": "simple-demo:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "simple-demo:build" + } + }, + "lint": { + "builder": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/simple-demo/src/**/*.ts"] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "apps/simple-demo/jest.config.js", + "passWithNoTests": true + } + } + } + }, + "simple-demo-e2e": { + "root": "apps/simple-demo-e2e", + "sourceRoot": "apps/simple-demo-e2e/src", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/simple-demo-e2e/cypress.json", + "tsConfig": "apps/simple-demo-e2e/tsconfig.e2e.json", + "devServerTarget": "simple-demo:serve" + }, + "configurations": { + "production": { + "devServerTarget": "simple-demo:serve:production" + } + } + }, + "lint": { + "builder": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/simple-demo-e2e/**/*.{js,ts}"] + } + } + } } }, "cli": { diff --git a/apps/demo/src/app/Modules/features/designer/components/designer-dashboard/designer-dashboard.component.spec.ts b/apps/demo/src/app/Modules/features/designer/components/designer-dashboard/designer-dashboard.component.spec.ts deleted file mode 100644 index fdcd93b..0000000 --- a/apps/demo/src/app/Modules/features/designer/components/designer-dashboard/designer-dashboard.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DesignerDashboardComponent } from './designer-dashboard.component'; - -describe('DesignerDashboardComponent', () => { - let component: DesignerDashboardComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [DesignerDashboardComponent], - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DesignerDashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/apps/demo/src/app/Modules/features/library/components/view-library/view-library.component.spec.ts b/apps/demo/src/app/Modules/features/library/components/view-library/view-library.component.spec.ts deleted file mode 100644 index 4349784..0000000 --- a/apps/demo/src/app/Modules/features/library/components/view-library/view-library.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ViewLibraryComponent } from './view-library.component'; - -describe('ViewLibraryComponent', () => { - let component: ViewLibraryComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ViewLibraryComponent], - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ViewLibraryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/apps/demo/src/app/Modules/layout/components/layout/layout.component.spec.ts b/apps/demo/src/app/Modules/layout/components/layout/layout.component.spec.ts deleted file mode 100644 index f9afb63..0000000 --- a/apps/demo/src/app/Modules/layout/components/layout/layout.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { LayoutComponent } from './layout.component'; - -describe('LayoutComponent', () => { - let component: LayoutComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [LayoutComponent], - }).compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(LayoutComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/apps/demo/src/app/app.component.spec.ts b/apps/demo/src/app/app.component.spec.ts deleted file mode 100644 index 3093fc4..0000000 --- a/apps/demo/src/app/app.component.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { TestBed, async } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [RouterTestingModule], - declarations: [AppComponent], - }).compileComponents(); - })); - - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app).toBeTruthy(); - }); - - it(`should have as title 'breadcrumbapp'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.componentInstance; - expect(app.title).toEqual('breadcrumbapp'); - }); - - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.nativeElement; - expect(compiled.querySelector('.content span').textContent).toContain( - 'breadcrumbapp app is running!' - ); - }); -}); diff --git a/apps/simple-demo-e2e/.eslintrc.json b/apps/simple-demo-e2e/.eslintrc.json new file mode 100644 index 0000000..6f3ade9 --- /dev/null +++ b/apps/simple-demo-e2e/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["src/plugins/index.js"], + "rules": { + "@typescript-eslint/no-var-requires": "off", + "no-undef": "off" + } + } + ] +} diff --git a/apps/simple-demo-e2e/cypress.json b/apps/simple-demo-e2e/cypress.json new file mode 100644 index 0000000..5934f10 --- /dev/null +++ b/apps/simple-demo-e2e/cypress.json @@ -0,0 +1,12 @@ +{ + "fileServerFolder": ".", + "fixturesFolder": "./src/fixtures", + "integrationFolder": "./src/integration", + "modifyObstructiveCode": false, + "pluginsFile": "./src/plugins/index", + "supportFile": "./src/support/index.ts", + "video": true, + "videosFolder": "../../dist/cypress/apps/simple-demo-e2e/videos", + "screenshotsFolder": "../../dist/cypress/apps/simple-demo-e2e/screenshots", + "chromeWebSecurity": false +} diff --git a/apps/simple-demo-e2e/src/fixtures/example.json b/apps/simple-demo-e2e/src/fixtures/example.json new file mode 100644 index 0000000..294cbed --- /dev/null +++ b/apps/simple-demo-e2e/src/fixtures/example.json @@ -0,0 +1,4 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io" +} diff --git a/apps/simple-demo-e2e/src/integration/app.spec.ts b/apps/simple-demo-e2e/src/integration/app.spec.ts new file mode 100644 index 0000000..f1a7fdb --- /dev/null +++ b/apps/simple-demo-e2e/src/integration/app.spec.ts @@ -0,0 +1,8 @@ +describe('simple-demo', () => { + it('should contain breadcrumbs for books', () => { + cy.visit('/'); + cy.get('xng-breadcrumb').contains('FirstPage'); + // shouldn't have default seperator if Home breadcrumb is not defined + cy.get('.xng-breadcrumb-list').contains('/').should('not.exist'); + }); +}); diff --git a/apps/simple-demo-e2e/src/plugins/index.js b/apps/simple-demo-e2e/src/plugins/index.js new file mode 100644 index 0000000..9067e75 --- /dev/null +++ b/apps/simple-demo-e2e/src/plugins/index.js @@ -0,0 +1,22 @@ +// *********************************************************** +// This example plugins/index.js can be used to load plugins +// +// You can change the location of this file or turn off loading +// the plugins file with the 'pluginsFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/plugins-guide +// *********************************************************** + +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) + +const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); + +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config + + // Preprocess Typescript file using Nx helper + on('file:preprocessor', preprocessTypescript(config)); +}; diff --git a/apps/simple-demo-e2e/src/support/app.po.ts b/apps/simple-demo-e2e/src/support/app.po.ts new file mode 100644 index 0000000..3293424 --- /dev/null +++ b/apps/simple-demo-e2e/src/support/app.po.ts @@ -0,0 +1 @@ +export const getGreeting = () => cy.get('h1'); diff --git a/apps/simple-demo-e2e/src/support/commands.ts b/apps/simple-demo-e2e/src/support/commands.ts new file mode 100644 index 0000000..310f1fa --- /dev/null +++ b/apps/simple-demo-e2e/src/support/commands.ts @@ -0,0 +1,33 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** + +// eslint-disable-next-line @typescript-eslint/no-namespace +declare namespace Cypress { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface Chainable { + login(email: string, password: string): void; + } +} +// +// -- This is a parent command -- +Cypress.Commands.add('login', (email, password) => { + console.log('Custom command example: Login', email, password); +}); +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/apps/simple-demo-e2e/src/support/index.ts b/apps/simple-demo-e2e/src/support/index.ts new file mode 100644 index 0000000..3d469a6 --- /dev/null +++ b/apps/simple-demo-e2e/src/support/index.ts @@ -0,0 +1,17 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; diff --git a/apps/simple-demo-e2e/tsconfig.e2e.json b/apps/simple-demo-e2e/tsconfig.e2e.json new file mode 100644 index 0000000..9dc3660 --- /dev/null +++ b/apps/simple-demo-e2e/tsconfig.e2e.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "sourceMap": false, + "outDir": "../../dist/out-tsc", + "allowJs": true, + "types": ["cypress", "node"] + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} diff --git a/apps/simple-demo-e2e/tsconfig.json b/apps/simple-demo-e2e/tsconfig.json new file mode 100644 index 0000000..08841a7 --- /dev/null +++ b/apps/simple-demo-e2e/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.e2e.json" + } + ] +} diff --git a/apps/simple-demo/.browserslistrc b/apps/simple-demo/.browserslistrc new file mode 100644 index 0000000..0ccadaf --- /dev/null +++ b/apps/simple-demo/.browserslistrc @@ -0,0 +1,18 @@ +# 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 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line. +not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. diff --git a/apps/simple-demo/.eslintrc.json b/apps/simple-demo/.eslintrc.json new file mode 100644 index 0000000..54ac395 --- /dev/null +++ b/apps/simple-demo/.eslintrc.json @@ -0,0 +1 @@ +{ "extends": "../../.eslintrc.json", "ignorePatterns": ["!**/*"], "rules": {} } diff --git a/apps/simple-demo/jest.config.js b/apps/simple-demo/jest.config.js new file mode 100644 index 0000000..329d838 --- /dev/null +++ b/apps/simple-demo/jest.config.js @@ -0,0 +1,23 @@ +module.exports = { + displayName: 'simple-demo', + preset: '../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + globals: { + 'ts-jest': { + tsConfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + astTransformers: { + before: [ + 'jest-preset-angular/build/InlineFilesTransformer', + 'jest-preset-angular/build/StripStylesTransformer', + ], + }, + }, + }, + coverageDirectory: '../../coverage/apps/simple-demo', + snapshotSerializers: [ + 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', + 'jest-preset-angular/build/AngularSnapshotSerializer.js', + 'jest-preset-angular/build/HTMLCommentSerializer.js', + ], +}; diff --git a/apps/simple-demo/src/app/app.component.css b/apps/simple-demo/src/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/apps/simple-demo/src/app/app.component.html b/apps/simple-demo/src/app/app.component.html new file mode 100644 index 0000000..ff69bfd --- /dev/null +++ b/apps/simple-demo/src/app/app.component.html @@ -0,0 +1,6 @@ +

xng-breadcrumb

+

Angular version {{ name }}

+ + + + diff --git a/apps/simple-demo/src/app/app.component.ts b/apps/simple-demo/src/app/app.component.ts new file mode 100644 index 0000000..23cf8bf --- /dev/null +++ b/apps/simple-demo/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component, VERSION } from '@angular/core'; + +@Component({ + selector: 'my-app', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'], +}) +export class AppComponent { + name = 'Angular ' + VERSION.major; +} diff --git a/apps/simple-demo/src/app/app.module.ts b/apps/simple-demo/src/app/app.module.ts new file mode 100644 index 0000000..38047a3 --- /dev/null +++ b/apps/simple-demo/src/app/app.module.ts @@ -0,0 +1,16 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; + +import { BreadcrumbModule } from '@xng/xng-breadcrumb'; +import { AppRoutingModule } from './app.routing.module'; + +import { AppComponent } from './app.component'; +import { Page1Component } from './page1.component'; +import { Page2Component } from './page2.component'; +@NgModule({ + declarations: [AppComponent, Page1Component, Page2Component], + imports: [BrowserModule, BreadcrumbModule, AppRoutingModule], + providers: [], + bootstrap: [AppComponent], +}) +export class AppModule {} diff --git a/apps/simple-demo/src/app/app.routing.module.ts b/apps/simple-demo/src/app/app.routing.module.ts new file mode 100644 index 0000000..4c71b13 --- /dev/null +++ b/apps/simple-demo/src/app/app.routing.module.ts @@ -0,0 +1,32 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { Page1Component } from './page1.component'; +import { Page2Component } from './page2.component'; + +export const appRoutes: Routes = [ + { + path: '', + redirectTo: 'page1', + pathMatch: 'full', + }, + { + path: 'page1', + component: Page1Component, + data: { + breadcrumb: 'FirstPage', + }, + }, + { + path: 'page2', + component: Page2Component, + data: { + breadcrumb: 'Next Page', + }, + }, +]; + +@NgModule({ + imports: [RouterModule.forRoot(appRoutes)], + exports: [RouterModule], +}) +export class AppRoutingModule {} diff --git a/apps/simple-demo/src/app/hello.component.ts b/apps/simple-demo/src/app/hello.component.ts new file mode 100644 index 0000000..e0dbeac --- /dev/null +++ b/apps/simple-demo/src/app/hello.component.ts @@ -0,0 +1,16 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'hello', + template: `

Hello {{ name }}!

`, + styles: [ + ` + h1 { + font-family: Lato; + } + `, + ], +}) +export class HelloComponent { + @Input() name: string; +} diff --git a/apps/simple-demo/src/app/page1.component.ts b/apps/simple-demo/src/app/page1.component.ts new file mode 100644 index 0000000..9135b12 --- /dev/null +++ b/apps/simple-demo/src/app/page1.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'page1', + template: `

In Page 1

`, +}) +export class Page1Component {} diff --git a/apps/simple-demo/src/app/page2.component.ts b/apps/simple-demo/src/app/page2.component.ts new file mode 100644 index 0000000..242bc3e --- /dev/null +++ b/apps/simple-demo/src/app/page2.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'page2', + template: `

In Page 2

`, +}) +export class Page2Component {} diff --git a/apps/simple-demo/src/assets/.gitkeep b/apps/simple-demo/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/simple-demo/src/environments/environment.prod.ts b/apps/simple-demo/src/environments/environment.prod.ts new file mode 100644 index 0000000..c966979 --- /dev/null +++ b/apps/simple-demo/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true, +}; diff --git a/apps/simple-demo/src/environments/environment.ts b/apps/simple-demo/src/environments/environment.ts new file mode 100644 index 0000000..99c3763 --- /dev/null +++ b/apps/simple-demo/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false, +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/apps/simple-demo/src/favicon.ico b/apps/simple-demo/src/favicon.ico new file mode 100644 index 0000000..317ebcb Binary files /dev/null and b/apps/simple-demo/src/favicon.ico differ diff --git a/apps/simple-demo/src/index.html b/apps/simple-demo/src/index.html new file mode 100644 index 0000000..528ed48 --- /dev/null +++ b/apps/simple-demo/src/index.html @@ -0,0 +1,13 @@ + + + + + SimpleDemo + + + + + + + + diff --git a/apps/simple-demo/src/main.ts b/apps/simple-demo/src/main.ts new file mode 100644 index 0000000..d9a2e7e --- /dev/null +++ b/apps/simple-demo/src/main.ts @@ -0,0 +1,13 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/apps/simple-demo/src/polyfills.ts b/apps/simple-demo/src/polyfills.ts new file mode 100644 index 0000000..e49856e --- /dev/null +++ b/apps/simple-demo/src/polyfills.ts @@ -0,0 +1,62 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/apps/simple-demo/src/styles.css b/apps/simple-demo/src/styles.css new file mode 100644 index 0000000..90d4ee0 --- /dev/null +++ b/apps/simple-demo/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/simple-demo/src/test-setup.ts b/apps/simple-demo/src/test-setup.ts new file mode 100644 index 0000000..8d88704 --- /dev/null +++ b/apps/simple-demo/src/test-setup.ts @@ -0,0 +1 @@ +import 'jest-preset-angular'; diff --git a/apps/simple-demo/tsconfig.app.json b/apps/simple-demo/tsconfig.app.json new file mode 100644 index 0000000..e9fa6df --- /dev/null +++ b/apps/simple-demo/tsconfig.app.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [] + }, + "files": ["src/main.ts", "src/polyfills.ts"] +} diff --git a/apps/simple-demo/tsconfig.editor.json b/apps/simple-demo/tsconfig.editor.json new file mode 100644 index 0000000..20c4afd --- /dev/null +++ b/apps/simple-demo/tsconfig.editor.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["**/*.ts"], + "compilerOptions": { + "types": ["jest", "node"] + } +} diff --git a/apps/simple-demo/tsconfig.json b/apps/simple-demo/tsconfig.json new file mode 100644 index 0000000..81cb95e --- /dev/null +++ b/apps/simple-demo/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./tsconfig.editor.json" + } + ] +} diff --git a/apps/simple-demo/tsconfig.spec.json b/apps/simple-demo/tsconfig.spec.json new file mode 100644 index 0000000..cfff29a --- /dev/null +++ b/apps/simple-demo/tsconfig.spec.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/jest.config.js b/jest.config.js index 9090b49..42e1c44 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,4 +6,5 @@ module.exports = { resolver: '@nrwl/jest/plugins/resolver', moduleFileExtensions: ['ts', 'js', 'html'], coverageReporters: ['html'], + projects: '/apps/simple-demo', }; diff --git a/libs/xng-breadcrumb/src/lib/breadcrumb.service.ts b/libs/xng-breadcrumb/src/lib/breadcrumb.service.ts index 5ab940e..e2e9215 100644 --- a/libs/xng-breadcrumb/src/lib/breadcrumb.service.ts +++ b/libs/xng-breadcrumb/src/lib/breadcrumb.service.ts @@ -17,6 +17,9 @@ const PATH_PARAM = { REGEX_REPLACER: '/[^/]+', }; const ALIAS_PREFIX = '@'; +const isNonEmpty = (obj: unknown): boolean => { + return obj && Object.keys(obj).length > 0; +}; @Injectable({ providedIn: 'root', @@ -70,7 +73,7 @@ export class BreadcrumbService { const rootBreadcrumb = this.extractObject(rootConfig?.data?.breadcrumb); const storeItem = this.getFromStore(rootBreadcrumb.alias, '/'); - if (rootConfig || storeItem) { + if (isNonEmpty(rootBreadcrumb) || isNonEmpty(storeItem)) { return { ...storeItem, ...rootBreadcrumb, diff --git a/nx.json b/nx.json index b4da4f4..b41e634 100644 --- a/nx.json +++ b/nx.json @@ -42,6 +42,13 @@ }, "demo": { "tags": [] + }, + "simple-demo": { + "tags": [] + }, + "simple-demo-e2e": { + "tags": [], + "implicitDependencies": ["simple-demo"] } } } diff --git a/package.json b/package.json index b2c26c6..839f576 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "copy-version": "VERSION=$npm_package_version && cd libs/xng-breadcrumb && npm version $VERSION && cd ../..", "commit-version": "git add . && git commit -m $npm_package_version", "push-tags": "git push --follow-tags origin master", - "release": "git pull origin master && standard-version", + "release": "git checkput master && git pull origin master && standard-version", "postrelease": "npm-run-all copy-* commit-version push-tags" }, "private": true,