Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
[NG] Export Conditional and Expand Directives (#2457)
Browse files Browse the repository at this point in the history
* [NG] Export Conditional and Expand Directives

Signed-off-by: Aditya Bhandari <[email protected]>
  • Loading branch information
adibwoy authored Jul 16, 2018
1 parent 36054e5 commit db68154
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/clr-angular/utils/conditional/if-active.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import { Component, ViewChild } from '@angular/core';
import { TestBed } from '@angular/core/testing';

import { IfActiveDirective } from './if-active.directive';
import { ClrIfActive } from './if-active.directive';
import { IF_ACTIVE_ID_PROVIDER, IfActiveService } from './if-active.service';

export default function(): void {
describe('IfActive Directive', function() {
describe('Typescript API', function() {
beforeEach(function() {
TestBed.configureTestingModule({
declarations: [IfActiveDirective, IfOpenTest],
declarations: [ClrIfActive, IfOpenTest],
providers: [IfActiveService, IF_ACTIVE_ID_PROVIDER],
});
this.fixture = TestBed.createComponent(IfOpenTest);
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function(): void {
describe('View', function() {
beforeEach(function() {
TestBed.configureTestingModule({
declarations: [IfActiveDirective, IfOpenTest],
declarations: [ClrIfActive, IfOpenTest],
providers: [IfActiveService, IF_ACTIVE_ID_PROVIDER],
});
this.fixture = TestBed.createComponent(IfOpenTest);
Expand Down Expand Up @@ -128,6 +128,6 @@ export default function(): void {
`,
})
class IfOpenTest {
@ViewChild(IfActiveDirective) directive: IfActiveDirective;
@ViewChild(ClrIfActive) directive: ClrIfActive;
activeState: boolean = false;
}
4 changes: 2 additions & 2 deletions src/clr-angular/utils/conditional/if-active.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import { IF_ACTIVE_ID, IfActiveService } from './if-active.service';

/**********
*
* @class IfActiveDirective
* @class ClrIfActive
*
* @description
* A structural directive that controls whether or not the associated TemplateRef is instantiated or not.
* It makes use of a Component instance level service: IfActiveService to maintain state between itself and
* the component using it in the component template.
*
*/
export class IfActiveDirective implements OnDestroy {
export class ClrIfActive implements OnDestroy {
private subscription: Subscription;
private wasActive: boolean = false;

Expand Down
8 changes: 4 additions & 4 deletions src/clr-angular/utils/conditional/if-open.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import { Component, ViewChild } from '@angular/core';
import { TestBed } from '@angular/core/testing';

import { IfOpenDirective } from './if-open.directive';
import { ClrIfOpen } from './if-open.directive';
import { IfOpenService } from './if-open.service';

export default function(): void {
describe('IfOpen Directive', function() {
describe('Typescript API', function() {
beforeEach(function() {
TestBed.configureTestingModule({ declarations: [IfOpenDirective, IfOpenTest], providers: [IfOpenService] });
TestBed.configureTestingModule({ declarations: [ClrIfOpen, IfOpenTest], providers: [IfOpenService] });
this.fixture = TestBed.createComponent(IfOpenTest);
this.fixture.detectChanges();
this.testComponent = this.fixture.componentInstance;
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function(): void {

describe('View', function() {
beforeEach(function() {
TestBed.configureTestingModule({ declarations: [IfOpenDirective, IfOpenTest], providers: [IfOpenService] });
TestBed.configureTestingModule({ declarations: [ClrIfOpen, IfOpenTest], providers: [IfOpenService] });
this.fixture = TestBed.createComponent(IfOpenTest);
this.fixture.detectChanges();
this.testComponent = this.fixture.componentInstance;
Expand Down Expand Up @@ -103,6 +103,6 @@ export default function(): void {
`,
})
class IfOpenTest {
@ViewChild(IfOpenDirective) directive: IfOpenDirective;
@ViewChild(ClrIfOpen) directive: ClrIfOpen;
openState: boolean = false;
}
4 changes: 2 additions & 2 deletions src/clr-angular/utils/conditional/if-open.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import { IfOpenService } from './if-open.service';

/**********
*
* @class IfOpenDirective
* @class ClrIfOpen
*
* @description
* A structural directive that controls whether or not the associated TemplateRef is instantiated or not.
* It makes use of a Component instance level service: IfOpenService to maintain state between itself and the component
* using it in the component template.
*
*/
export class IfOpenDirective implements OnDestroy {
export class ClrIfOpen implements OnDestroy {
private subscription: Subscription;

/*********
Expand Down
6 changes: 3 additions & 3 deletions src/clr-angular/utils/conditional/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* The full license information can be found in LICENSE in the root directory of this project.
*/
import { Type } from '@angular/core';
import { IfActiveDirective } from './if-active.directive';
import { IfOpenDirective } from './if-open.directive';
import { ClrIfActive } from './if-active.directive';
import { ClrIfOpen } from './if-open.directive';

export * from './if-active.directive';
export * from './if-open.directive';

export const CONDITIONAL_DIRECTIVES: Type<any>[] = [IfActiveDirective, IfOpenDirective];
export const CONDITIONAL_DIRECTIVES: Type<any>[] = [ClrIfActive, ClrIfOpen];
8 changes: 4 additions & 4 deletions src/clr-angular/utils/expand/if-expanded.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { Component, Inject, ViewChild } from '@angular/core';
import { TestBed } from '@angular/core/testing';

import { IfExpanded } from './if-expanded';
import { ClrIfExpanded } from './if-expanded';
import { Expand } from './providers/expand';

export default function(): void {
Expand All @@ -18,7 +18,7 @@ export default function(): void {
* we can't use our usual shortcut, we need to rely on @ViewChild.
* A quick investigation didn't reveal a better solution yet, we might want to look into it more.
*/
TestBed.configureTestingModule({ declarations: [IfExpanded, SimpleTest, TestCounter], providers: [Expand] });
TestBed.configureTestingModule({ declarations: [ClrIfExpanded, SimpleTest, TestCounter], providers: [Expand] });
this.fixture = TestBed.createComponent(SimpleTest);
this.fixture.detectChanges();
this.testComponent = this.fixture.componentInstance;
Expand Down Expand Up @@ -72,7 +72,7 @@ export default function(): void {
* we can't use our usual shortcut, we need to rely on @ViewChild.
* A quick investigation didn't reveal a better solution yet, we might want to look into it more.
*/
TestBed.configureTestingModule({ declarations: [IfExpanded, NgIfTest], providers: [Expand] });
TestBed.configureTestingModule({ declarations: [ClrIfExpanded, NgIfTest], providers: [Expand] });
this.fixture = TestBed.createComponent(NgIfTest);
this.fixture.detectChanges();
this.testComponent = this.fixture.componentInstance;
Expand Down Expand Up @@ -101,7 +101,7 @@ export default function(): void {
providers: [{ provide: 'counter', useValue: { total: 0 } }],
})
class SimpleTest {
@ViewChild(IfExpanded) ifExpanded: IfExpanded;
@ViewChild(ClrIfExpanded) ifExpanded: ClrIfExpanded;

constructor(@Inject('counter') public counter: { total: number }) {}
}
Expand Down
2 changes: 1 addition & 1 deletion src/clr-angular/utils/expand/if-expanded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Expand } from './providers/expand';
* TODO: make this a reusable directive outside of Datagrid, like [clrLoading].
*/
@Directive({ selector: '[clrIfExpanded]' })
export class IfExpanded implements OnInit, OnDestroy {
export class ClrIfExpanded implements OnInit, OnDestroy {
private _expanded: boolean = false;

get expanded(): boolean {
Expand Down
4 changes: 2 additions & 2 deletions src/clr-angular/utils/expand/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* The full license information can be found in LICENSE in the root directory of this project.
*/
import { Type } from '@angular/core';
import { IfExpanded } from './if-expanded';
import { ClrIfExpanded } from './if-expanded';

export * from './if-expanded';

export const EXPAND_DIRECTIVES: Type<any>[] = [IfExpanded];
export const EXPAND_DIRECTIVES: Type<any>[] = [ClrIfExpanded];
2 changes: 2 additions & 0 deletions src/clr-angular/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

export * from './animations/index';
export * from './loading/index';
export * from './conditional/index';
export * from './expand/index';

0 comments on commit db68154

Please sign in to comment.