Add tag manager container for link click tracking #6

Merged
cameron merged 6 commits from feature/link-out-analytics into master 2020-08-14 18:39:53 +00:00
2 changed files with 12 additions and 3 deletions
Showing only changes of commit 5885bda92c - Show all commits

View File

@@ -1,14 +1,23 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {RouterTestingModule} from '@angular/router/testing';
import { ContactComponent } from './contact.component'; import { ContactComponent } from './contact.component';
import { Angulartics2 } from 'angulartics2';
describe('ContactComponent', () => { describe('ContactComponent', () => {
let component: ContactComponent; let component: ContactComponent;
let fixture: ComponentFixture<ContactComponent>; let fixture: ComponentFixture<ContactComponent>;
beforeEach(async(() => { beforeEach(async(() => {
const analytics = jasmine.createSpyObj('piwik', ['startTracking']);
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ ContactComponent ] imports: [
RouterTestingModule,
],
declarations: [ ContactComponent ],
providers: [
{ provide: Angulartics2, useValue: analytics },
],
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@@ -36,12 +36,12 @@ describe('ToolbarComponent', () => {
}); });
it('should contain a material toolbar', () => { it('should contain a material toolbar', () => {
expect(fixture.debugElement.children[0].nativeElement.className).toBe('mat-drawer-container mat-sidenav-container'); expect(fixture.debugElement.children[0].nativeElement.className).toBe('mat-toolbar mat-toolbar-multiple-rows');
}); });
it('should contain 4 links, Home, Resume, Projects, Contact', () => { it('should contain 4 links, Home, Resume, Projects, Contact', () => {
const debugElements = fixture.debugElement.queryAll((element) => { const debugElements = fixture.debugElement.queryAll((element) => {
return element.nativeElement.className.indexOf('mat-toolbar') !== -1; return element.nativeElement.className.indexOf('mat-toolbar-row') !== -1;
}); });
expect(debugElements[0].children.length).toBe(4); expect(debugElements[0].children.length).toBe(4);