parent
48636ad947
commit
3997dd090e
@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["@babel/preset-env"]
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import 'jest-preset-angular';
|
||||
// const { defaults } = require('jest-config');
|
||||
|
||||
//
|
||||
// module.exports = {
|
||||
// verbose: true,
|
||||
// collectCoverage: true,
|
||||
// // collectCoverageFrom: ['src/**/*.ts'],
|
||||
// collectCoverageFrom: ['src/app/pages/admin/*.ts'],
|
||||
// };
|
||||
Error.stackTraceLimit = 2;
|
@ -0,0 +1 @@
|
||||
<p>footer works!</p>
|
@ -1,19 +1,19 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HeaderComponent } from './header.component';
|
||||
import { FooterComponent } from './footer.component';
|
||||
|
||||
describe('HeaderComponent', () => {
|
||||
let component: HeaderComponent;
|
||||
let fixture: ComponentFixture<HeaderComponent>;
|
||||
describe('FooterComponent', () => {
|
||||
let component: FooterComponent;
|
||||
let fixture: ComponentFixture<FooterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [HeaderComponent],
|
||||
declarations: [FooterComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderComponent);
|
||||
fixture = TestBed.createComponent(FooterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-footer',
|
||||
templateUrl: './footer.component.html',
|
||||
styleUrls: ['./footer.component.scss'],
|
||||
})
|
||||
export class FooterComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
<div class="home_link">
|
||||
<a [routerLink]="'home'" aria-roledescription="home">
|
||||
<a class="button" routerLink="/home" aria-roledescription="home">
|
||||
<h1>
|
||||
<span class="logo_first">Frama</span>
|
||||
<span class="logo_second">date</span>
|
||||
(démo)
|
||||
<span class="logo_second">Sondage</span>
|
||||
</h1>
|
||||
</a>
|
||||
<div class="legend">
|
||||
<a class="button legend" href="https://framasoft.org/" target="_blank">
|
||||
proposé par
|
||||
<span class="legend_first">Frama</span>
|
||||
<span class="legend_second">soft</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
@ -1,19 +1,19 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LanguageComponent } from './language.component';
|
||||
import { LogoComponent } from './logo.component';
|
||||
|
||||
describe('LanguageComponent', () => {
|
||||
let component: LanguageComponent;
|
||||
let fixture: ComponentFixture<LanguageComponent>;
|
||||
describe('LogoComponent', () => {
|
||||
let component: LogoComponent;
|
||||
let fixture: ComponentFixture<LogoComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [LanguageComponent],
|
||||
declarations: [LogoComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LanguageComponent);
|
||||
fixture = TestBed.createComponent(LogoComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-logo',
|
||||
templateUrl: './logo.component.html',
|
||||
styleUrls: ['./logo.component.scss'],
|
||||
})
|
||||
export class LogoComponent {}
|
@ -0,0 +1 @@
|
||||
<p>navbar works!</p>
|
@ -1,19 +1,19 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SelectorComponent } from './selector.component';
|
||||
import { NavbarComponent } from './navbar.component';
|
||||
|
||||
describe('SelectorComponent', () => {
|
||||
let component: SelectorComponent;
|
||||
let fixture: ComponentFixture<SelectorComponent>;
|
||||
describe('NavbarComponent', () => {
|
||||
let component: NavbarComponent;
|
||||
let fixture: ComponentFixture<NavbarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SelectorComponent],
|
||||
declarations: [NavbarComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SelectorComponent);
|
||||
fixture = TestBed.createComponent(NavbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar',
|
||||
templateUrl: './navbar.component.html',
|
||||
styleUrls: ['./navbar.component.scss'],
|
||||
})
|
||||
export class NavbarComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
<div class="hero">
|
||||
This page doesn't exist.
|
||||
</div>
|
@ -1,19 +1,19 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MasterHeadComponent } from './master-head.component';
|
||||
import { PageNotFoundComponent } from './page-not-found.component';
|
||||
|
||||
describe('MasterHeadComponent', () => {
|
||||
let component: MasterHeadComponent;
|
||||
let fixture: ComponentFixture<MasterHeadComponent>;
|
||||
describe('PageNotFoundComponent', () => {
|
||||
let component: PageNotFoundComponent;
|
||||
let fixture: ComponentFixture<PageNotFoundComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [MasterHeadComponent],
|
||||
declarations: [PageNotFoundComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MasterHeadComponent);
|
||||
fixture = TestBed.createComponent(PageNotFoundComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-not-found',
|
||||
templateUrl: './page-not-found.component.html',
|
||||
styleUrls: ['./page-not-found.component.scss'],
|
||||
})
|
||||
export class PageNotFoundComponent {}
|
@ -0,0 +1,20 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
import { LogoComponent } from './components/logo/logo.component';
|
||||
import { NavbarComponent } from './components/navbar/navbar.component';
|
||||
import { PageNotFoundComponent } from './components/page-not-found/page-not-found.component';
|
||||
import { throwIfAlreadyLoaded } from './guards/module-import.guard';
|
||||
|
||||
@NgModule({
|
||||
declarations: [FooterComponent, LogoComponent, NavbarComponent, PageNotFoundComponent],
|
||||
imports: [CommonModule, RouterModule],
|
||||
exports: [FooterComponent, LogoComponent, NavbarComponent, PageNotFoundComponent],
|
||||
})
|
||||
export class CoreModule {
|
||||
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
|
||||
throwIfAlreadyLoaded(parentModule, 'CoreModule');
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export enum Language {
|
||||
FR = 'FR',
|
||||
EN = 'EN',
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
export enum Theme {
|
||||
LIGHT = 'LIGHT',
|
||||
DARK = 'DARK',
|
||||
RED = 'RED',
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
export function throwIfAlreadyLoaded(parentModule: any, moduleName: string): void {
|
||||
if (parentModule) {
|
||||
throw new Error(`${moduleName} has already been loaded. Import ${moduleName} in the AppModule only.`);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StorageService } from './storage.service';
|
||||
|
||||
describe('StorageService', () => {
|
||||
let service: StorageService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(StorageService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { LocalStorage } from 'ngx-webstorage';
|
||||
|
||||
import { Language } from '../enums/language.enum';
|
||||
import { Theme } from '../enums/theme.enum';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class StorageService {
|
||||
@LocalStorage()
|
||||
public theme: Theme;
|
||||
|
||||
@LocalStorage()
|
||||
public language: Language;
|
||||
|
||||
@LocalStorage()
|
||||
public userPollsIds: string[];
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { Theme } from '../enums/theme.enum';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ThemeService {
|
||||
private _theme: BehaviorSubject<Theme> = new BehaviorSubject<Theme>(Theme.LIGHT);
|
||||
public readonly theme: Observable<Theme> = this._theme.asObservable();
|
||||
|
||||
public selectTheme(theme: Theme): void {
|
||||
this._theme.next(theme);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { AdministrationComponent } from './administration.component';
|
||||
|
||||
const routes: Routes = [{ path: '', component: AdministrationComponent }];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AdministrationRoutingModule {}
|
@ -0,0 +1 @@
|
||||
<p>administration works!</p>
|
@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdministrationComponent } from './administration.component';
|
||||
|
||||
describe('AdministrationComponent', () => {
|
||||
let component: AdministrationComponent;
|
||||
let fixture: ComponentFixture<AdministrationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AdministrationComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdministrationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-administration',
|
||||
templateUrl: './administration.component.html',
|
||||
styleUrls: ['./administration.component.scss'],
|
||||
})
|
||||
export class AdministrationComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { AdministrationRoutingModule } from './administration-routing.module';
|
||||
import { AdministrationComponent } from './administration.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AdministrationComponent],
|
||||
imports: [CommonModule, AdministrationRoutingModule, SharedModule, TranslateModule.forChild({ extend: true })],
|
||||
})
|
||||
export class AdministrationModule {}
|
@ -0,0 +1,12 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { ParticipationComponent } from './participation.component';
|
||||
|
||||
const routes: Routes = [{ path: '', component: ParticipationComponent }];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class ParticipationRoutingModule {}
|
@ -0,0 +1,2 @@
|
||||
<p>participation works!</p>
|
||||
<p>It should display an existing poll, which user wants to participate by voting.</p>
|
@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ParticipationComponent } from './participation.component';
|
||||
|
||||
describe('ParticipationComponent', () => {
|
||||
let component: ParticipationComponent;
|
||||
let fixture: ComponentFixture<ParticipationComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ParticipationComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ParticipationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-participation',
|
||||
templateUrl: './participation.component.html',
|
||||
styleUrls: ['./participation.component.scss'],
|
||||
})
|
||||
export class ParticipationComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { ParticipationRoutingModule } from './participation-routing.module';
|
||||
import { ParticipationComponent } from './participation.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ParticipationComponent],
|
||||
imports: [CommonModule, ParticipationRoutingModule, SharedModule, TranslateModule.forChild({ extend: true })],
|
||||
})
|
||||
export class ParticipationModule {}
|