Skip to content

Instantly share code, notes, and snippets.

View t-palmer's full-sized avatar

Todd Palmer t-palmer

  • Fujitsu
View GitHub Profile
@t-palmer
t-palmer / child-stub.component.spec.ts
Created March 12, 2019 23:50
Child stub component with providers for testing
import { Component } from '@angular/core';
import { ChildComponent } from './child.component';
@Component({
selector: 'app-child',
template: '',
providers: [
{
provide: ChildComponent,
useClass: ChildStubComponent
@t-palmer
t-palmer / parent.component.spec.ts
Created March 9, 2019 22:28
Example spec file for parent component for viewchild-unit-test-example
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ParentComponent } from './parent.component';
import { ChildComponent } from '../child/child.component';
import { ChildStubComponent } from '../child/child-stub.component.spec';
describe('ParentComponent', () => {
let component: ParentComponent;
let fixture: ComponentFixture<ParentComponent>;
beforeEach(async(() => {
@t-palmer
t-palmer / child-stub.component.spec.ts
Created March 9, 2019 16:04
Example stub for child component for viewchild-unit-test-example
import { Component } from '@angular/core';
@Component({
selector: 'app-child',
template: ''
})
export class ChildStubComponent {
timeStamp;
ngOnInit() {}
@t-palmer
t-palmer / child-stub.component.spec.ts
Created March 9, 2019 12:50
Example stub for child component for viewchild-unit-test-example
import { Component } from '@angular/core';
@Component({
selector: 'app-child',
template: ''
})
export class ChildStubComponent {
updateTimeStamp() {}
}
@t-palmer
t-palmer / parent.component.spec.ts
Created March 9, 2019 12:36
Example spec file for parent component for viewchild-unit-test-example
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ParentComponent } from './parent.component';
import { ChildComponent } from '../child/child.component';
describe('ParentComponent', () => {
let component: ParentComponent;
let fixture: ComponentFixture<ParentComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
@t-palmer
t-palmer / parent.component.ts
Created March 9, 2019 03:18
Example parent component for viewchild-unit-test-example
import { Component, ViewChild } from '@angular/core';
import { ChildComponent } from '../child/child.component';
@Component({
selector: 'app-parent',
template: `
<button type="button" (click)="update()">Update</button>
<br>
<app-child></app-child>`
})
@t-palmer
t-palmer / child.component.ts
Created March 9, 2019 03:15
Example child component for viewchild-unit-test-example
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-child',
template: `Timestamp: {{timeStamp}}`
})
export class ChildComponent implements OnInit {
public timeStamp: Date;
ngOnInit() {
@t-palmer
t-palmer / ng-configuration-app.component.html
Created July 18, 2018 22:42
ng-configuration App Component example
<h1>
Environment
</h1>
<pre>{{env | json}}</pre>
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Example</h2>
<enl-example-ng6-lib></enl-example-ng6-lib>
<enl-foo></enl-foo>
/*
* Public API Surface of example-ng6-lib
*/
export * from './lib/example-ng6-lib.service';
export * from './lib/example-ng6-lib.component';
export * from './lib/example-ng6-lib.module';
export * from './lib/foo/foo.component';