Commit 2e68472d authored by Virgil TOURNEUR's avatar Virgil TOURNEUR

Initial commit

parents
# 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.
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
# ApiSystSolaire
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
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.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"api-syst-solaire": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/api-syst-solaire",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"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": "api-syst-solaire:build"
},
"configurations": {
"production": {
"browserTarget": "api-syst-solaire:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "api-syst-solaire:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "api-syst-solaire:serve"
},
"configurations": {
"production": {
"devServerTarget": "api-syst-solaire:serve:production"
}
}
}
}
}
},
"defaultProject": "api-syst-solaire"
}
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};
\ No newline at end of file
import { browser, logging } from 'protractor';
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', async () => {
await page.navigateTo();
expect(await page.getTitleText()).toEqual('api-syst-solaire app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
import { browser, by, element } from 'protractor';
export class AppPage {
async navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl);
}
async getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText();
}
}
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"node"
]
}
}
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-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
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/api-syst-solaire'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
This diff is collapsed.
{
"name": "api-syst-solaire",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.2.4",
"@angular/common": "~11.2.4",
"@angular/compiler": "~11.2.4",
"@angular/core": "~11.2.4",
"@angular/forms": "~11.2.4",
"@angular/material": "^11.2.3",
"@angular/platform-browser": "~11.2.4",
"@angular/platform-browser-dynamic": "~11.2.4",
"@angular/router": "~11.2.4",
"rxjs": "~6.6.0",
"rxjs-compat": "^6.6.6",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1102.3",
"@angular/cli": "~11.2.3",
"@angular/compiler-cli": "~11.2.4",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.5"
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Routes } from '@angular/router';
import { PlanetsListComponent } from './planets-list/planets-list.component';
import { UranusMoonsComponent } from './uranus-moons/uranus-moons.component';
import { NeptuneMoonsComponent } from './neptune-moons/neptune-moons.component';
import { JupiterMoonsComponent } from './jupiter-moons/jupiter-moons.component';
import { MarsMoonsComponent } from './mars-moons/mars-moons.component';
import { MercureMoonsComponent } from './mercure-moons/mercure-moons.component';
import { SaturneMoonsComponent } from './saturne-moons/saturne-moons.component';
import { TerreMoonsComponent } from './terre-moons/terre-moons.component';
import { VenusMoonsComponent } from './venus-moons/venus-moons.component';
const routes: Routes = [
{ path: '', component: PlanetsListComponent, pathMatch: 'full'},
{ path: 'uranus', component: UranusMoonsComponent, outlet: 'uranus'},
{ path: 'neptune', component: NeptuneMoonsComponent, outlet: 'netpune'},
{ path: 'jupiter', component: JupiterMoonsComponent, outlet: 'jupiter'},
{ path: 'mars', component: MarsMoonsComponent, outlet: 'mars'},
{ path: 'mercure', component: MercureMoonsComponent, outlet: 'mercure'},
{ path: 'saturne', component: SaturneMoonsComponent, outlet: 'saturne'},
{ path: 'terre', component: TerreMoonsComponent, outlet: 'terre'},
{ path: 'venus', component: VenusMoonsComponent, outlet: 'venus'}
];
@NgModule({
declarations: [],
imports: [
CommonModule
]
})
export class AppRoutingModule { }
.container {
margin: 25 25;
text-align: center;
font-family: 'Raleway', sans-serif;
}
\ No newline at end of file
<div class="container">
<h1 style=font-size:120px>Système solaire :</h1>
</div>
<router-outlet></router-outlet>
\ No newline at end of file
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
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 'api-syst-solaire'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('api-syst-solaire');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('api-syst-solaire app is running!');
});
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'api-syst-solaire';
}
import { NgModule } from '@angular/core';
import { BrowserModule, DomSanitizer } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { PlanetsService } from './services/planets.service';
import { PlanetsListComponent } from './planets-list/planets-list.component';
import { RouterModule } from '@angular/router';
import { DepFlags } from '@angular/compiler/src/core';
import { AppRoutingModule } from './app-routing.module';
import { UranusMoonsComponent } from './uranus-moons/uranus-moons.component';
import { NeptuneMoonsComponent } from './neptune-moons/neptune-moons.component';
import { JupiterMoonsComponent } from './jupiter-moons/jupiter-moons.component';
import { MarsMoonsComponent } from './mars-moons/mars-moons.component';
import { MercureMoonsComponent } from './mercure-moons/mercure-moons.component';
import { SaturneMoonsComponent } from './saturne-moons/saturne-moons.component';
import { TerreMoonsComponent } from './terre-moons/terre-moons.component';
import { VenusMoonsComponent } from './venus-moons/venus-moons.component';
@NgModule({
declarations: [
AppComponent,
PlanetsListComponent,
UranusMoonsComponent,
NeptuneMoonsComponent,
JupiterMoonsComponent,
MarsMoonsComponent,
MercureMoonsComponent,
SaturneMoonsComponent,
TerreMoonsComponent,
VenusMoonsComponent,
],
imports: [
BrowserModule,
HttpClientModule,
RouterModule.forRoot([
{
path: '',
component: PlanetsListComponent
},
{
path: 'uranus',
component: UranusMoonsComponent
},
{
path: 'neptune',
component: NeptuneMoonsComponent
},
{
path: 'jupiter',
component: JupiterMoonsComponent
},
{
path: 'mars',
component: MarsMoonsComponent
},
{
path: 'mercure',
component: MercureMoonsComponent
},
{
path: 'saturne',
component: SaturneMoonsComponent
},
{
path: 'terre',
component:TerreMoonsComponent
},
{
path: 'venus',
component: VenusMoonsComponent
}
]),
AppRoutingModule
],
providers: [PlanetsService],
bootstrap: [AppComponent]
})
export class AppModule { }
<p>Satellites de Jupiter!</p>
<div class="moons" *ngIf="moonsJupiter">
<div class="moon" *ngFor="let moon of moonsJupiter" >
<span>{{moon.name}}</span>
<ul>
<li *ngIf="moon.discoveredBy">Découverte par : {{moon.discoveredBy}}</li>
<li *ngIf="moon.discoveryDate">Découverte en : {{moon.discoveryDate}}</li>
<li>Temps de rotation : {{moon.sideralOrbit}}</li>
</ul>
</div>
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { JupiterMoonsComponent } from './jupiter-moons.component';