This repository has been archived by the owner on Aug 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca5318d
commit 438aba8
Showing
5 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
exports[`BaseComponent should render something 1`] = ` | ||
<xmpl-base | ||
class="bound" | ||
disabled={false} | ||
style="overflow: hidden; display: block" | ||
title="super" | ||
> | ||
<div | ||
class="container" | ||
> | ||
<div | ||
class="active" | ||
ng-reflect-ng-class="[object Object]" | ||
/> | ||
<input | ||
class="no-async" | ||
type="text" | ||
value={ | ||
ZoneAwarePromise { | ||
"__zone_symbol__state": true, | ||
"__zone_symbol__value": 1, | ||
} | ||
} | ||
/> | ||
<input | ||
class="with-async" | ||
type="text" | ||
value={2} | ||
/> | ||
<input | ||
class="2w" | ||
type="text" | ||
value={3} | ||
valueChange={[Function]} | ||
/> | ||
Just text | ||
YET ANOTHER TEXT | ||
<button | ||
click={[Function]} | ||
> | ||
Click me! | ||
</button> | ||
<svg> | ||
<rect | ||
height="100" | ||
width="100" | ||
x="0" | ||
y="0" | ||
/> | ||
</svg> | ||
</div> | ||
</gp-article-card> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="container" #id> | ||
<div [ngClass]="{'active': !disabled}"></div> | ||
<ng-container *ngIf="ifPass"> | ||
<input class="no-async" type="text" [value]="promiseValue" /> | ||
<input class="with-async" type="text" [value]="observableValue | async" /> | ||
<input class="2w" type="text" [(value)]="twoWayValue" /> | ||
</ng-container> | ||
<ng-container *ngIf="ifNotPass"> | ||
<span>Am I visible?</span> | ||
</ng-container> | ||
Just text | ||
{{'yet another text' | uppercase}} | ||
<button (click)="doStuff()">Click me!</button> | ||
<svg> | ||
<rect x="0" y="0" width="100" height="100" /> | ||
</svg> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
|
||
import { BaseComponent } from './base.component'; | ||
|
||
describe('BaseComponent', () => { | ||
let component: BaseComponent; | ||
let fixture: ComponentFixture<BaseComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [BaseComponent], | ||
schemas: [NO_ERRORS_SCHEMA] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(BaseComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it(`should render something`, () => { | ||
fixture.detectChanges(); | ||
|
||
expect(fixture).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/of'; | ||
|
||
import { Component, Input, HostBinding } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'xmpl-base', | ||
templateUrl: './base.component.html' | ||
}) | ||
export class BaseComponent { | ||
@Input() promiseValue = Promise.resolve(1); | ||
@Input() observableValue = Observable.of(2); | ||
@Input() twoWayValue = 3; | ||
|
||
@HostBinding('class.bound') | ||
bound = true; | ||
@HostBinding('class.not-bound') | ||
notBound = false; | ||
@HostBinding('attr.title') | ||
title = 'super'; | ||
@HostBinding('style.overflow') | ||
overflow = 'hidden'; | ||
@HostBinding('style.display') | ||
get display() { return 'block'; } | ||
@HostBinding('disabled') | ||
get disabled() { return false; } | ||
|
||
ifPass = true; | ||
ifNotPass = false; | ||
|
||
doStuff() {} | ||
} |