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
import { Component, State } from '@stencil/core'; | |
import { Hero } from '../../models/hero'; | |
import { HeroService } from '../../services/hero.service'; | |
@Component({ | |
tag: 'app-heroes', | |
styleUrl: 'heroes.css' | |
}) | |
export class Heroes { |
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
import { Observable, Subject } from 'rxjs'; | |
export class MessageService { | |
private static _instance: MessageService; | |
private messages: string[] = []; | |
private subject: Subject<string[]> = new Subject(); | |
add(message: string) { |
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
import { render } from '@stencil/core/testing'; | |
import { Messages } from './messages'; | |
describe('app-messages', () => { | |
it('should build', () => { | |
expect(new Messages()).toBeTruthy(); | |
}); | |
describe('rendering', () => { | |
beforeEach(async () => { |
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
import { Component, State } from '@stencil/core'; | |
import { MessageService } from '../../services/message.service'; | |
@Component({ | |
tag: 'app-messages', | |
styleUrl: 'messages.css' | |
}) | |
export class Messages { | |
private messageService: MessageService; |
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
<main> | |
<stencil-router> | |
<stencil-route url='/' component='app-heroes' exact={true}> | |
</stencil-route> | |
</stencil-router> | |
</main> |
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
/* DashboardComponent's private CSS styles */ | |
[class*='col-'] { | |
float: left; | |
padding-right: 20px; | |
padding-bottom: 20px; | |
} | |
[class*='col-']:last-of-type { | |
padding-right: 0; | |
} | |
a { |
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
import { render } from '@stencil/core/testing'; | |
import { Dashboard } from './dashboard'; | |
describe('app-dashboard', () => { | |
it('should build', () => { | |
expect(new Dashboard()).toBeTruthy(); | |
}); | |
describe('rendering', () => { | |
beforeEach(async () => { |
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
import { Component, State } from '@stencil/core'; | |
import { Hero } from '../../models/hero'; | |
import { HeroService } from '../../services/hero.service'; | |
@Component({ | |
tag: 'app-dashboard', | |
styleUrl: 'dashboard.css' | |
}) | |
export class Dashboard { |
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
<stencil-route-link url={`/detail/${hero.id}`} class="col-1-4"> | |
<div class="module hero"> | |
<h4>{hero.name}</h4> | |
</div> | |
</stencil-route-link> |