Skip to content

Commit

Permalink
WIP #8 Added page title to all page components
Browse files Browse the repository at this point in the history
- #36 Fixed up all service and component tests ready for full implementation
  • Loading branch information
Bidthedog committed Feb 12, 2019
1 parent d7ed833 commit 56bdd36
Show file tree
Hide file tree
Showing 29 changed files with 230 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src/DNI.Web/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { FaqComponent } from 'app/components/pages/faq/faq.component';
import { CommunityGuidelinesComponent } from 'app/components/pages/community-guidelines/community-guidelines.component';

const routes: Routes = [
{ path: '', component: HomeComponent },
{ path: '', component: HomeComponent, data: { title: 'fuuuuuu' } },
{ path: 'community-guidelines', component: CommunityGuidelinesComponent },
{ path: 'faq', component: FaqComponent },
{ path: 'privacy', component: PrivacyComponent },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h4>Engage in positive conflict resolution</h4>

<h4>In all seriousness..</h4>
<p>Laughing, joking, teasing, and yes, even trolling is something that will happen. We're developers. We believe our community to be mature enough to understand there can be subtlety when teasing/joking/trolling. We trust our community to be mindful enough to communicate and seek clarity instead of assuming the intent of a comment.</p>
<p>To clarify what is not acceptable joking/testing/trolling see our Discrimination, Favouritism & Nepotism section in our <a [routerLink]="['/ethics']">Code of Ethics</a>. There are better parts of a person to target for trolling: their favourite coding language, editor, coding methodologies...the list goes on.</p>
<p>To clarify what is not acceptable joking/testing/trolling see our Discrimination, Favouritism &amp; Nepotism section in our <a [routerLink]="['/ethics']">Code of Ethics</a>. There are better parts of a person to target for trolling: their favourite coding language, editor, coding methodologies...the list goes on.</p>

<h3>Code of Conduct</h3>
<h4>Be Mindful</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { CommunityGuidelinesComponent } from './community-guidelines.component';
import { RouterTestingModule } from '@angular/router/testing';

describe('CommunityGuidelinesComponent', () => {
let component: CommunityGuidelinesComponent;
let fixture: ComponentFixture<CommunityGuidelinesComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CommunityGuidelinesComponent ]
declarations: [CommunityGuidelinesComponent],
imports: [
RouterTestingModule
]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Component, OnInit } from '@angular/core';

import { SEOService } from 'app/services/seo/seo.service';

@Component({
selector: 'dni-community-guidelines',
templateUrl: './community-guidelines.component.html',
styleUrls: ['./community-guidelines.component.scss']
})
export class CommunityGuidelinesComponent implements OnInit {

constructor() { }
constructor(
private seoService: SEOService
) { }

ngOnInit() {
this.seoService.setTitle('Community Guidelines');
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { FormsModule } from '@angular/forms';

import { TabsModule } from 'ngx-bootstrap';
import { NgxCaptchaModule } from 'ngx-captcha';

import { ContactComponent } from './contact.component';
import { LoadingComponent } from 'app/components/shared/loading/loading.component';
import { SocialLinksComponent } from 'app/components/shared/social-links/social-links.component';

describe('ContactComponent', () => {
let component: ContactComponent;
let fixture: ComponentFixture<ContactComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContactComponent ]
declarations: [
ContactComponent,
LoadingComponent,
SocialLinksComponent
],
imports: [
RouterTestingModule,
TabsModule.forRoot(),
FormsModule,
NgxCaptchaModule,
HttpClientTestingModule
]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { Component, OnInit, Inject, PLATFORM_ID } from '@angular/core';

import { environment } from 'environments/environment';

import { CaptchaService } from 'app/services/captcha/captcha.service';
import { ContactService } from 'app/services/contact/contact.service';
import { CaptchaBaseComponent } from 'app/services/captcha/captcha-base.component';
import { ContactModel } from 'app/services/contact/contact-model';
import { environment } from 'environments/environment';
import { SEOService } from 'app/services/seo/seo.service';


@Component({
selector: 'dni-contact',
templateUrl: './contact.component.html',
styleUrls: ['./contact.component.scss'],
providers: [
CaptchaService,
ContactService
]
styleUrls: ['./contact.component.scss']
})
export class ContactComponent extends CaptchaBaseComponent implements OnInit {

Expand All @@ -26,12 +24,15 @@ export class ContactComponent extends CaptchaBaseComponent implements OnInit {
constructor(
protected captchaService: CaptchaService,
protected contactService: ContactService,
@Inject(PLATFORM_ID) protected platformId: Object
@Inject(PLATFORM_ID) protected platformId: Object,
private seoService: SEOService
) {
super(captchaService, platformId);
}

ngOnInit() {
this.seoService.setTitle('Contact Us');

this.reCaptchaSiteKey = environment.recaptchaSiteKey;
this.state = 'init';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Component, OnInit } from '@angular/core';

import { SEOService } from 'app/services/seo/seo.service';

@Component({
selector: 'dni-ethics',
templateUrl: './ethics.component.html',
styleUrls: ['./ethics.component.scss']
})
export class EthicsComponent implements OnInit {

constructor() { }
constructor(
private seoService: SEOService
) { }

ngOnInit() {
this.seoService.setTitle('Code of Ethics');
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FaqComponent } from './faq.component';
import { RouterTestingModule } from '@angular/router/testing';

describe('FaqComponent', () => {
let component: FaqComponent;
let fixture: ComponentFixture<FaqComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FaqComponent ]
declarations: [FaqComponent],
imports: [
RouterTestingModule
]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
9 changes: 6 additions & 3 deletions src/DNI.Web/src/app/components/pages/faq/faq.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Component, OnInit } from '@angular/core';

import { SEOService } from 'app/services/seo/seo.service';

@Component({
selector: 'dni-faq',
templateUrl: './faq.component.html',
styleUrls: ['./faq.component.scss']
})
export class FaqComponent implements OnInit {

constructor() { }
constructor(
private seoService: SEOService
) { }

ngOnInit() {
this.seoService.setTitle('Frequently Asked Questions');
}

}
22 changes: 19 additions & 3 deletions src/DNI.Web/src/app/components/pages/home/home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';

import { LeftPadPipe } from 'angular-pipes';
import { CookieLawModule } from 'app/components/shared/angular2-cookie-law/angular2-cookie-law.module';

import { HomeComponent } from './home.component';
import { SocialLinksComponent } from 'app/components/shared/social-links/social-links.component';
import { MeetTheCreatorsComponent } from 'app/components/shared/meet-the-creators/meet-the-creators.component';
import { LoadingComponent } from 'app/components/shared/loading/loading.component';

describe('AppComponent', () => {
describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
RouterTestingModule,
HttpClientTestingModule,
CookieLawModule
],
declarations: [
HomeComponent
HomeComponent,
SocialLinksComponent,
LeftPadPipe,
MeetTheCreatorsComponent,
LoadingComponent
],
}).compileComponents();
}));

it('should create component', async(() => {
const fixture = TestBed.createComponent(HomeComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));

// it(`should inject appId`, async(() => {
// const fixture = TestBed.createComponent(HomeComponent);
// const app = fixture.debugElement.componentInstance;
Expand Down
18 changes: 11 additions & 7 deletions src/DNI.Web/src/app/components/pages/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Component, OnInit, Inject, PLATFORM_ID } from '@angular/core';
import { CountdownService } from 'app/services/countdown/countdown.service';
import { isPlatformBrowser } from '@angular/common';

import { Observable } from 'rxjs';

import { TickData } from 'app/services/countdown/tick-data';
import { isPlatformBrowser } from '@angular/common';
import { CountdownService } from 'app/services/countdown/countdown.service';
import { SEOService } from 'app/services/seo/seo.service';

@Component({
selector: 'dni-root',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
providers: [CountdownService]
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
private timer$: Observable<TickData>;
Expand All @@ -17,11 +19,13 @@ export class HomeComponent implements OnInit {

constructor(
private countdownService: CountdownService,
@Inject(PLATFORM_ID) protected platformId: Object
) {
}
@Inject(PLATFORM_ID) protected platformId: Object,
private seoService: SEOService
) { }

ngOnInit(): void {
this.seoService.setTitle('Home');

// Set up the initial timer properties
this.timer$ = this.countdownService.createTimer(4, 19, 0);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { PageNotFoundComponent } from './page-not-found.component';
import { RouterTestingModule } from '@angular/router/testing';

describe('PageNotFoundComponent', () => {
let component: PageNotFoundComponent;
let fixture: ComponentFixture<PageNotFoundComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PageNotFoundComponent ]
declarations: [PageNotFoundComponent],
imports: [
RouterTestingModule
]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Component, OnInit } from '@angular/core';

import { SEOService } from 'app/services/seo/seo.service';

@Component({
selector: 'dni-page-not-found',
templateUrl: './page-not-found.component.html',
styleUrls: ['./page-not-found.component.scss']
})
export class PageNotFoundComponent implements OnInit {

constructor() { }
constructor(
private seoService: SEOService
) { }

ngOnInit() {
this.seoService.setTitle('404 Page Not Found');
}

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Component, OnInit } from '@angular/core';

import { SEOService } from 'app/services/seo/seo.service';

@Component({
selector: 'dni-privacy',
templateUrl: './privacy.component.html',
styleUrls: ['./privacy.component.scss']
})
export class PrivacyComponent implements OnInit {

constructor() { }
constructor(
private seoService: SEOService
) { }

ngOnInit() {
this.seoService.setTitle('Cookie and Privacy Policy');
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';

import { CollapseModule } from 'ngx-bootstrap';

import { ShowArchiveComponent } from './show-archive.component';
import { SafePipe } from 'app/components/shared/safe-pipe/safe.pipe';
import { LoadingComponent } from 'app/components/shared/loading/loading.component';

describe('ShowArchiveComponent', () => {
let component: ShowArchiveComponent;
let fixture: ComponentFixture<ShowArchiveComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ShowArchiveComponent ]
declarations: [
ShowArchiveComponent,
LoadingComponent,
SafePipe
],
imports: [
RouterTestingModule,
CollapseModule,
HttpClientTestingModule
]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
Loading

0 comments on commit 56bdd36

Please sign in to comment.