diff --git a/.editorconfig b/.editorconfig index 59d9a3a..f166060 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,7 @@ trim_trailing_whitespace = true [*.ts] quote_type = single +ij_typescript_use_double_quotes = false [*.md] max_line_length = off diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index a99a824..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "root": true, - "ignorePatterns": ["projects/**/*"], - "overrides": [ - { - "files": ["*.ts"], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@angular-eslint/recommended", - "plugin:@angular-eslint/template/process-inline-templates" - ], - "rules": { - "@angular-eslint/directive-selector": [ - "error", - { - "type": "attribute", - "prefix": "pmo", - "style": "camelCase" - } - ], - "@angular-eslint/component-selector": [ - "error", - { - "type": "element", - "prefix": "pmo", - "style": "kebab-case" - } - ] - } - }, - { - "files": ["*.html"], - "extends": [ - "plugin:@angular-eslint/template/recommended", - "plugin:@angular-eslint/template/accessibility" - ], - "rules": {} - } - ] -} diff --git a/.gitignore b/.gitignore index 3b628ce..ca8d1a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. +# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. # Compiled output /dist diff --git a/angular.json b/angular.json index d157a7f..ab2d1d5 100644 --- a/angular.json +++ b/angular.json @@ -5,17 +5,7 @@ "projects": { "sample-pmo": { "projectType": "application", - "schematics": { - "@schematics/angular:component": { - "standalone": false - }, - "@schematics/angular:directive": { - "standalone": false - }, - "@schematics/angular:pipe": { - "standalone": false - } - }, + "schematics": {}, "root": "", "sourceRoot": "src", "prefix": "pmo", @@ -29,12 +19,14 @@ "polyfills": ["zone.js"], "tsConfig": "tsconfig.app.json", "assets": [ - "src/favicon.ico", - "src/assets", + { + "glob": "**/*", + "input": "public" + }, { "glob": "**/*", "input": "./node_modules/place-my-order-assets/images/", - "output": "./assets/images" + "output": "./public/images" } ], "styles": [ @@ -48,13 +40,13 @@ "budgets": [ { "type": "initial", - "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumWarning": "500kB", + "maximumError": "1MB" }, { "type": "anyComponentStyle", - "maximumWarning": "2kb", - "maximumError": "4kb" + "maximumWarning": "4kB", + "maximumError": "8kB" } ], "outputHashing": "all" @@ -86,17 +78,19 @@ "defaultConfiguration": "development" }, "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "buildTarget": "sample-pmo:build" - } + "builder": "@angular-devkit/build-angular:extract-i18n" }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "polyfills": ["zone.js", "zone.js/testing"], "tsConfig": "tsconfig.spec.json", - "assets": ["src/favicon.ico", "src/assets"], + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], "styles": ["src/styles.css"], "scripts": [] } @@ -108,31 +102,6 @@ } } } - }, - "sample-pmo-e2e": { - "root": "e2e/", - "projectType": "application", - "prefix": "", - "architect": { - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "sample-pmo:serve" - }, - "configurations": { - "production": { - "devServerTarget": "sample-pmo:serve:production" - } - } - }, - "lint": { - "builder": "@angular-eslint/builder:lint", - "options": { - "lintFilePatterns": ["e2e//**/*.ts", "e2e//**/*.html"] - } - } - } } }, "cli": { diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 0967ef4..0000000 --- a/cypress.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index 02e4254..0000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/cypress/integration/0-pmo-demo/pmo.spec.js b/cypress/integration/0-pmo-demo/pmo.spec.js deleted file mode 100644 index 0cd1879..0000000 --- a/cypress/integration/0-pmo-demo/pmo.spec.js +++ /dev/null @@ -1,48 +0,0 @@ -/// -describe("example pmo-app", () => { - beforeEach(() => { - // Cypress starts out with a blank slate for each test - // so we must tell it to visit our website with the `cy.visit()` command. - // Since we want to visit the same URL at the start of all our tests, - // we include it in our beforeEach function so that it runs before each test - cy.visit("http://localhost:4200/"); - }); - - it("should have 3 menu options in the header", () => { - cy.get("[data-test=pmo-header] li").should("have.length", 3); - cy.get("[data-test=pmo-header] li").first().should("have.text", "Home"); - cy.get("[data-test=pmo-header] li") - .last() - .should("have.text", "Order History"); - }); - - it("should display restaurants in the city of Detroit", () => { - cy.get("[data-test=pmo-home__button--choose").click(); - cy.get("[data-test=pmo-restaurant__select--state]").select(["Michigan"]); - cy.get("[data-test=pmo-restaurant__select--city]").select(["Detroit"]); - - cy.get("[data-test=pmo-restaurant__list]") - .should("have.length", 2) - .find("h3") - .first() - .should("have.text", "Crab Barn"); - }); - - it("should choose Crab Barn restaurant and place a order", () => { - cy.showRestaurantsFrom("Michigan", "Detroit"); - - cy.get("[data-test=pmo-restaurant__list]") - .first() - .find("[data-test=pmo-restaurant__button--details]") - .click(); - }); - - it("fetches list of states items - GET", () => { - cy.request("/api/states").as("statesRequest"); - cy.get("@statesRequest").then((states) => { - expect(states.status).to.eq(200); - assert.isArray(states.body.data, "States Response is an array"); - expect(states.body.data).to.have.length(3); - }); - }); -}); diff --git a/cypress/integration/1-getting-started/todo.spec.js b/cypress/integration/1-getting-started/todo.spec.js deleted file mode 100644 index 4768ff9..0000000 --- a/cypress/integration/1-getting-started/todo.spec.js +++ /dev/null @@ -1,143 +0,0 @@ -/// - -// Welcome to Cypress! -// -// This spec file contains a variety of sample tests -// for a todo list app that are designed to demonstrate -// the power of writing tests in Cypress. -// -// To learn more about how Cypress works and -// what makes it such an awesome testing tool, -// please read our getting started guide: -// https://on.cypress.io/introduction-to-cypress - -describe('example to-do app', () => { - beforeEach(() => { - // Cypress starts out with a blank slate for each test - // so we must tell it to visit our website with the `cy.visit()` command. - // Since we want to visit the same URL at the start of all our tests, - // we include it in our beforeEach function so that it runs before each test - cy.visit('https://example.cypress.io/todo') - }) - - it('displays two todo items by default', () => { - // We use the `cy.get()` command to get all elements that match the selector. - // Then, we use `should` to assert that there are two matched items, - // which are the two default items. - cy.get('.todo-list li').should('have.length', 2) - - // We can go even further and check that the default todos each contain - // the correct text. We use the `first` and `last` functions - // to get just the first and last matched elements individually, - // and then perform an assertion with `should`. - cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') - cy.get('.todo-list li').last().should('have.text', 'Walk the dog') - }) - - it('can add new todo items', () => { - // We'll store our item text in a variable so we can reuse it - const newItem = 'Feed the cat' - - // Let's get the input element and use the `type` command to - // input our new list item. After typing the content of our item, - // we need to type the enter key as well in order to submit the input. - // This input has a data-test attribute so we'll use that to select the - // element in accordance with best practices: - // https://on.cypress.io/selecting-elements - cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) - - // Now that we've typed our new item, let's check that it actually was added to the list. - // Since it's the newest item, it should exist as the last element in the list. - // In addition, with the two default items, we should have a total of 3 elements in the list. - // Since assertions yield the element that was asserted on, - // we can chain both of these assertions together into a single statement. - cy.get('.todo-list li') - .should('have.length', 3) - .last() - .should('have.text', newItem) - }) - - it('can check off an item as completed', () => { - // In addition to using the `get` command to get an element by selector, - // we can also use the `contains` command to get an element by its contents. - // However, this will yield the