Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/angular-examples-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
6 changes: 6 additions & 0 deletions apps/angular-examples-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname),
});
30 changes: 30 additions & 0 deletions apps/angular-examples-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "angular-examples-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/angular-examples-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/angular-examples-e2e/cypress.config.ts",
"devServerTarget": "angular-examples:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "angular-examples:serve:production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/angular-examples-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["angular-examples"]
}
13 changes: 13 additions & 0 deletions apps/angular-examples-e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('angular-examples', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome angular-examples');
});
});
4 changes: 4 additions & 0 deletions apps/angular-examples-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}
1 change: 1 addition & 0 deletions apps/angular-examples-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
33 changes: 33 additions & 0 deletions apps/angular-examples-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -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<Subject> {
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) => { ... })
17 changes: 17 additions & 0 deletions apps/angular-examples-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -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';
22 changes: 22 additions & 0 deletions apps/angular-examples-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"],
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"],
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
36 changes: 36 additions & 0 deletions apps/angular-examples/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "ae",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "ae",
"style": "kebab-case"
}
]
},
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/angular-examples/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'angular-examples',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
coverageDirectory: '../../coverage/apps/angular-examples',
transform: {
'^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
83 changes: 83 additions & 0 deletions apps/angular-examples/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "angular-examples",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/angular-examples/src",
"prefix": "ae",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/angular-examples",
"index": "apps/angular-examples/src/index.html",
"main": "apps/angular-examples/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/angular-examples/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"apps/angular-examples/src/favicon.ico",
"apps/angular-examples/src/assets",
{
"glob": "**/*",
"input": "styles/",
"output": "styles"
}
],
"styles": ["apps/angular-examples/src/styles.scss"],
"scripts": []
},
"configurations": {
"production": {
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "angular-examples:build:production"
},
"development": {
"browserTarget": "angular-examples:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-examples:build"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/angular-examples/**/*.ts",
"apps/angular-examples/**/*.html"
]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/angular-examples/jest.config.ts",
"passWithNoTests": true
}
}
},
"tags": []
}
17 changes: 17 additions & 0 deletions apps/angular-examples/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--<h2>Badge</h2>-->
<!--<ae-badge></ae-badge>-->
<!--<hr>-->

<!--<h2>Button</h2>-->
<!--<ae-button></ae-button>-->
<!--<hr>-->

<h2>Checkbox</h2>
<ae-checkbox></ae-checkbox>
<hr>

<h2>Text input</h2>
<ae-input></ae-input>
<hr>

<router-outlet></router-outlet>
Empty file.
16 changes: 16 additions & 0 deletions apps/angular-examples/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RouterModule } from '@angular/router';
import { Component } from '@angular/core';
import { ButtonComponent } from "./button/button.component";
import { BadgeComponent } from "./badge/badge.component";
import { CheckboxComponent } from "./checkbox/checkbox.component";
import { InputComponent } from "./input/input.component";

@Component({
standalone: true,
imports: [RouterModule, ButtonComponent, BadgeComponent, CheckboxComponent, InputComponent],
selector: 'ae-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
}
3 changes: 3 additions & 0 deletions apps/angular-examples/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Route } from '@angular/router';

export const appRoutes: Route[] = [];
58 changes: 58 additions & 0 deletions apps/angular-examples/src/app/badge/badge.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Component } from '@angular/core';
import { BadgeComponent as NucBadgeComponent } from '@rtuitlab/ng-ui-core';
import { NgForOf, NgIf } from "@angular/common";

@Component({
standalone: true,
selector: 'ae-badge',
template: `
<div
style="
display:grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 1rem;
align-items: center;
"
>
<ng-container
*ngFor="let type of types; let idx = index"
>
{{type}}
<ng-container
*ngFor="let color of colors"
>
<ng-container
*ngIf="
(type === 'transparent' && color === 'primary') ||
(type !== 'transparent'); else showEmpty"
>
<div>
<ng-container *ngIf="idx === 0">{{color}}</ng-container>

<nuc-badge
value="10"
[type]="type"
[color]="color"
></nuc-badge>
</div>
</ng-container>
<ng-template #showEmpty>
<div></div>
</ng-template>
</ng-container>
</ng-container>
</div>
`,
imports: [NucBadgeComponent, NgForOf, NgIf],
})
export class BadgeComponent {
types: ("outline" | "solid" | "light" | "transparent")[] = ['outline',
'solid',
'light',
'transparent'
]
colors: ("primary" | "red" | "green")[] = ['primary',
'red',
'green'
]
}
Loading