From db681543440e4cfc98224345302c8d270b0013c3 Mon Sep 17 00:00:00 2001 From: Aditya Bhandari Date: Mon, 16 Jul 2018 09:29:40 -0400 Subject: [PATCH] [NG] Export Conditional and Expand Directives (#2457) * [NG] Export Conditional and Expand Directives Signed-off-by: Aditya Bhandari --- .../utils/conditional/if-active.directive.spec.ts | 8 ++++---- src/clr-angular/utils/conditional/if-active.directive.ts | 4 ++-- .../utils/conditional/if-open.directive.spec.ts | 8 ++++---- src/clr-angular/utils/conditional/if-open.directive.ts | 4 ++-- src/clr-angular/utils/conditional/index.ts | 6 +++--- src/clr-angular/utils/expand/if-expanded.spec.ts | 8 ++++---- src/clr-angular/utils/expand/if-expanded.ts | 2 +- src/clr-angular/utils/expand/index.ts | 4 ++-- src/clr-angular/utils/index.ts | 2 ++ 9 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/clr-angular/utils/conditional/if-active.directive.spec.ts b/src/clr-angular/utils/conditional/if-active.directive.spec.ts index 8e696f2b42..f77314c96e 100644 --- a/src/clr-angular/utils/conditional/if-active.directive.spec.ts +++ b/src/clr-angular/utils/conditional/if-active.directive.spec.ts @@ -6,7 +6,7 @@ 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 { @@ -14,7 +14,7 @@ export default function(): void { 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); @@ -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); @@ -128,6 +128,6 @@ export default function(): void { `, }) class IfOpenTest { - @ViewChild(IfActiveDirective) directive: IfActiveDirective; + @ViewChild(ClrIfActive) directive: ClrIfActive; activeState: boolean = false; } diff --git a/src/clr-angular/utils/conditional/if-active.directive.ts b/src/clr-angular/utils/conditional/if-active.directive.ts index 93f12ae6a2..0c354b5ccc 100644 --- a/src/clr-angular/utils/conditional/if-active.directive.ts +++ b/src/clr-angular/utils/conditional/if-active.directive.ts @@ -21,7 +21,7 @@ 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. @@ -29,7 +29,7 @@ import { IF_ACTIVE_ID, IfActiveService } from './if-active.service'; * 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; diff --git a/src/clr-angular/utils/conditional/if-open.directive.spec.ts b/src/clr-angular/utils/conditional/if-open.directive.spec.ts index 0d50c5ffe5..9deb556cec 100644 --- a/src/clr-angular/utils/conditional/if-open.directive.spec.ts +++ b/src/clr-angular/utils/conditional/if-open.directive.spec.ts @@ -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; @@ -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; @@ -103,6 +103,6 @@ export default function(): void { `, }) class IfOpenTest { - @ViewChild(IfOpenDirective) directive: IfOpenDirective; + @ViewChild(ClrIfOpen) directive: ClrIfOpen; openState: boolean = false; } diff --git a/src/clr-angular/utils/conditional/if-open.directive.ts b/src/clr-angular/utils/conditional/if-open.directive.ts index 01a3042299..ff9cde6468 100644 --- a/src/clr-angular/utils/conditional/if-open.directive.ts +++ b/src/clr-angular/utils/conditional/if-open.directive.ts @@ -12,7 +12,7 @@ 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. @@ -20,7 +20,7 @@ import { IfOpenService } from './if-open.service'; * using it in the component template. * */ -export class IfOpenDirective implements OnDestroy { +export class ClrIfOpen implements OnDestroy { private subscription: Subscription; /********* diff --git a/src/clr-angular/utils/conditional/index.ts b/src/clr-angular/utils/conditional/index.ts index 12fce81601..8cce3b4a2a 100644 --- a/src/clr-angular/utils/conditional/index.ts +++ b/src/clr-angular/utils/conditional/index.ts @@ -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[] = [IfActiveDirective, IfOpenDirective]; +export const CONDITIONAL_DIRECTIVES: Type[] = [ClrIfActive, ClrIfOpen]; diff --git a/src/clr-angular/utils/expand/if-expanded.spec.ts b/src/clr-angular/utils/expand/if-expanded.spec.ts index 5617c114ec..950c19fe8d 100644 --- a/src/clr-angular/utils/expand/if-expanded.spec.ts +++ b/src/clr-angular/utils/expand/if-expanded.spec.ts @@ -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 { @@ -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; @@ -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; @@ -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 }) {} } diff --git a/src/clr-angular/utils/expand/if-expanded.ts b/src/clr-angular/utils/expand/if-expanded.ts index e85e4e6b25..676bc6bd9b 100644 --- a/src/clr-angular/utils/expand/if-expanded.ts +++ b/src/clr-angular/utils/expand/if-expanded.ts @@ -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 { diff --git a/src/clr-angular/utils/expand/index.ts b/src/clr-angular/utils/expand/index.ts index 0efcc92853..c3ab91322a 100644 --- a/src/clr-angular/utils/expand/index.ts +++ b/src/clr-angular/utils/expand/index.ts @@ -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[] = [IfExpanded]; +export const EXPAND_DIRECTIVES: Type[] = [ClrIfExpanded]; diff --git a/src/clr-angular/utils/index.ts b/src/clr-angular/utils/index.ts index 4b924c6410..fc452baae6 100644 --- a/src/clr-angular/utils/index.ts +++ b/src/clr-angular/utils/index.ts @@ -6,3 +6,5 @@ export * from './animations/index'; export * from './loading/index'; +export * from './conditional/index'; +export * from './expand/index';