Skip to content

Commit

Permalink
Merge pull request #142 from IKatsuba/feature/rename-directives
Browse files Browse the repository at this point in the history
feat(ngx-ssr-platform): rename directives
  • Loading branch information
IKatsuba authored Feb 12, 2021
2 parents ed06d3a + 7b67978 commit 3f7de38
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions libs/ngx-ssr/platform/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './lib/is-server.directive';
export * from './lib/is-browser.directive';
export * from './lib/if-is-server.directive';
export * from './lib/if-is-browser.directive';
export * from './lib/ngx-ssr-platform.module';
export * from './lib/tokens';
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { IsBrowserDirective } from './is-browser.directive';
import { IfIsBrowserDirective } from './if-is-browser.directive';
import { render, screen } from '@testing-library/angular';
import { IS_BROWSER_PLATFORM } from './tokens';

describe('IsBrowserDirective', () => {
it('should create an element', async () => {
await render(IsBrowserDirective, {
template: '<div *isBrowser>Some text</div>',
await render(IfIsBrowserDirective, {
template: '<div *ifIsBrowser>Some text</div>',
providers: [
{
provide: IS_BROWSER_PLATFORM,
Expand All @@ -20,8 +20,8 @@ describe('IsBrowserDirective', () => {
});

it('should not create an element', async () => {
await render(IsBrowserDirective, {
template: '<div *isBrowser>Some text</div>',
await render(IfIsBrowserDirective, {
template: '<div *ifIsBrowser>Some text</div>',
providers: [
{
provide: IS_BROWSER_PLATFORM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { IS_BROWSER_PLATFORM } from './tokens';

@Directive({
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[isBrowser]',
selector: '[ifIsBrowser]',
})
export class IsBrowserDirective {
export class IfIsBrowserDirective {
constructor(
@Inject(IS_BROWSER_PLATFORM) isBrowser: boolean,
templateRef: TemplateRef<any>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { IsServerDirective } from './is-server.directive';
import { IfIsServerDirective } from './if-is-server.directive';
import { render, screen } from '@testing-library/angular';
import { IS_SERVER_PLATFORM } from './tokens';

describe('IsServerDirective', () => {
it('should create an element', async () => {
await render(IsServerDirective, {
template: '<div *isServer>Some text</div>',
await render(IfIsServerDirective, {
template: '<div *ifIsServer>Some text</div>',
providers: [
{
provide: IS_SERVER_PLATFORM,
Expand All @@ -20,8 +20,8 @@ describe('IsServerDirective', () => {
});

it('should not create an element', async () => {
await render(IsServerDirective, {
template: '<div *isServer>Some text</div>',
await render(IfIsServerDirective, {
template: '<div *ifIsServer>Some text</div>',
providers: [
{
provide: IS_SERVER_PLATFORM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { IS_SERVER_PLATFORM } from './tokens';

@Directive({
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[isServer]',
selector: '[ifIsServer]',
})
export class IsServerDirective {
export class IfIsServerDirective {
constructor(
@Inject(IS_SERVER_PLATFORM) isServer: boolean,
templateRef: TemplateRef<any>,
Expand Down
8 changes: 4 additions & 4 deletions libs/ngx-ssr/platform/src/lib/ngx-ssr-platform.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IsBrowserDirective } from './is-browser.directive';
import { IsServerDirective } from './is-server.directive';
import { IfIsBrowserDirective } from './if-is-browser.directive';
import { IfIsServerDirective } from './if-is-server.directive';

@NgModule({
imports: [CommonModule],
declarations: [IsBrowserDirective, IsServerDirective],
exports: [IsBrowserDirective, IsServerDirective],
declarations: [IfIsBrowserDirective, IfIsServerDirective],
exports: [IfIsBrowserDirective, IfIsServerDirective],
})
export class NgxSsrPlatformModule {}

0 comments on commit 3f7de38

Please sign in to comment.