Skip to content

Commit

Permalink
Remove unnecesarry index.ts files (#192)
Browse files Browse the repository at this point in the history
- remove unnecessary index.ts files
- cleanup imports
- cleanup imports in tests
- remove "Created by ..." statements
  • Loading branch information
madoar committed Mar 9, 2019
1 parent 73def2a commit 713d97f
Show file tree
Hide file tree
Showing 49 changed files with 411 additions and 364 deletions.
30 changes: 15 additions & 15 deletions src/lib/archwizard.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import {CommonModule} from '@angular/common';
import {ModuleWithProviders, NgModule} from '@angular/core';

import {WizardCompletionStepComponent, WizardComponent, WizardNavigationBarComponent, WizardStepComponent} from './components';
import {
EnableBackLinksDirective,
GoToStepDirective,
NextStepDirective,
OptionalStepDirective,
PreviousStepDirective,
ResetWizardDirective,
SelectedStepDirective,
WizardCompletionStepDirective,
WizardStepDirective,
WizardStepSymbolDirective,
WizardStepTitleDirective
} from './directives';
import {WizardCompletionStepComponent} from './components/wizard-completion-step.component';
import {WizardNavigationBarComponent} from './components/wizard-navigation-bar.component';
import {WizardStepComponent} from './components/wizard-step.component';
import {WizardComponent} from './components/wizard.component';
import {EnableBackLinksDirective} from './directives/enable-back-links.directive';
import {GoToStepDirective} from './directives/go-to-step.directive';
import {NextStepDirective} from './directives/next-step.directive';
import {OptionalStepDirective} from './directives/optional-step.directive';
import {PreviousStepDirective} from './directives/previous-step.directive';
import {ResetWizardDirective} from './directives/reset-wizard.directive';
import {SelectedStepDirective} from './directives/selected-step.directive';
import {WizardCompletionStepDirective} from './directives/wizard-completion-step.directive';
import {WizardStepSymbolDirective} from './directives/wizard-step-symbol.directive';
import {WizardStepTitleDirective} from './directives/wizard-step-title.directive';
import {WizardStepDirective} from './directives/wizard-step.directive';

/**
* The module defining all the content inside `angular-archwizard`
Expand Down
4 changes: 0 additions & 4 deletions src/lib/components/index.ts

This file was deleted.

25 changes: 14 additions & 11 deletions src/lib/components/wizard-completion-step.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
/**
* Created by marc on 20.05.17.
*/
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {WizardCompletionStepComponent} from './wizard-completion-step.component';
import {Component} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {ArchwizardModule} from '../archwizard.module';
import {WizardState} from '../navigation/wizard-state.model';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStepComponent} from './wizard-completion-step.component';

@Component({
selector: 'aw-test-wizard',
template: `
<aw-wizard>
<aw-wizard-step stepTitle='Steptitle 1' (stepEnter)="enterInto($event, 1)" (stepExit)="exitFrom($event, 1)">Step 1</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' [canExit]="isValid"
awOptionalStep (stepEnter)="enterInto($event, 2)" (stepExit)="exitFrom($event, 2)">Step 2</aw-wizard-step>
<aw-wizard-completion-step stepTitle='Completion steptitle 3' (stepEnter)="enterInto($event, 3)">Step 3</aw-wizard-completion-step>
<aw-wizard-step stepTitle='Steptitle 1' (stepEnter)="enterInto($event, 1)" (stepExit)="exitFrom($event, 1)">
Step 1
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' [canExit]="isValid" awOptionalStep (stepEnter)="enterInto($event, 2)"
(stepExit)="exitFrom($event, 2)">
Step 2
</aw-wizard-step>
<aw-wizard-completion-step stepTitle='Completion steptitle 3' (stepEnter)="enterInto($event, 3)">
Step 3
</aw-wizard-completion-step>
</aw-wizard>
`
})
Expand Down
7 changes: 2 additions & 5 deletions src/lib/components/wizard-completion-step.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/**
* Created by marc on 20.05.17.
*/

import {Component, forwardRef, ViewEncapsulation} from '@angular/core';
import {WizardCompletionStep, WizardStep} from '../util';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';
import {WizardStep} from '../util/wizard-step.interface';

/**
* The `aw-wizard-completion-step` component can be used to define a completion/success step at the end of your wizard
Expand Down
22 changes: 14 additions & 8 deletions src/lib/components/wizard-navigation-bar.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import {Component, ViewChild} from '@angular/core';
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {Component, DebugElement, ViewChild} from '@angular/core';
import {WizardNavigationBarComponent} from './wizard-navigation-bar.component';
import {WizardComponent} from './wizard.component';
import {By} from '@angular/platform-browser';
import {ArchwizardModule} from '../archwizard.module';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {WizardNavigationBarComponent} from './wizard-navigation-bar.component';
import {WizardComponent} from './wizard.component';

@Component({
selector: 'aw-test-wizard',
template: `
<aw-wizard>
<aw-wizard-step stepTitle='Steptitle 1' [stepId]="firstStepId">Step 1</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' awOptionalStep>Step 2</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3'>Step 3</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 1' [stepId]="firstStepId">
Step 1
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' awOptionalStep>
Step 2
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3'>
Step 3
</aw-wizard-step>
</aw-wizard>
`
})
Expand Down Expand Up @@ -528,7 +534,7 @@ describe('WizardNavigationBarComponent', () => {
});

it('should show the correct step titles', () => {
let navigationLinks = wizardTestFixture.debugElement.queryAll(By.css('aw-wizard-navigation-bar ul li a'));
const navigationLinks = wizardTestFixture.debugElement.queryAll(By.css('aw-wizard-navigation-bar ul li a'));

expect(navigationLinks.length).toBe(3);
expect(navigationLinks[0].nativeElement.innerText).toBe('STEPTITLE 1');
Expand All @@ -540,7 +546,7 @@ describe('WizardNavigationBarComponent', () => {
wizardTest.wizard.navBarDirection = 'right-to-left';
wizardTestFixture.detectChanges();

let navigationLinks = wizardTestFixture.debugElement.queryAll(By.css('aw-wizard-navigation-bar ul li a'));
const navigationLinks = wizardTestFixture.debugElement.queryAll(By.css('aw-wizard-navigation-bar ul li a'));

expect(navigationLinks.length).toBe(3);
expect(navigationLinks[0].nativeElement.innerText).toBe('STEPTITLE 3');
Expand Down
19 changes: 10 additions & 9 deletions src/lib/components/wizard-navigation-bar.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, Input, ViewEncapsulation} from '@angular/core';
import {NavigationMode, WizardState} from '../navigation';
import {WizardStep} from '../util';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {WizardStep} from '../util/wizard-step.interface';

/**
* The `aw-wizard-navigation-bar` component contains the navigation bar inside a [[WizardComponent]].
Expand Down Expand Up @@ -29,13 +30,6 @@ export class WizardNavigationBarComponent {
@Input()
public direction = 'left-to-right';

/**
* The navigation mode
*/
public get navigationMode(): NavigationMode {
return this.wizardState.navigationMode;
}

/**
* Constructor
*
Expand All @@ -44,6 +38,13 @@ export class WizardNavigationBarComponent {
constructor(public wizardState: WizardState) {
}

/**
* The navigation mode
*/
public get navigationMode(): NavigationMode {
return this.wizardState.navigationMode;
}

/**
* Returns all [[WizardStep]]s contained in the wizard
*
Expand Down
20 changes: 13 additions & 7 deletions src/lib/components/wizard-step.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {WizardStepComponent} from './wizard-step.component';
import {Component} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {ArchwizardModule} from '../archwizard.module';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardStepComponent} from './wizard-step.component';

@Component({
selector: 'aw-test-wizard',
template: `
<aw-wizard>
<aw-wizard-step stepTitle='Steptitle 1' (stepEnter)="enterInto($event, 1)" (stepExit)="exitFrom($event, 1)">Step 1</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' [canExit]="isValid"
awOptionalStep (stepEnter)="enterInto($event, 2)" (stepExit)="exitFrom($event, 2)">Step 2</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3' (stepEnter)="enterInto($event, 3)" (stepExit)="exitFrom($event, 3)">Step 3</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 1' (stepEnter)="enterInto($event, 1)" (stepExit)="exitFrom($event, 1)">
Step 1
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' [canExit]="isValid" awOptionalStep (stepEnter)="enterInto($event, 2)"
(stepExit)="exitFrom($event, 2)">
Step 2
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3' (stepEnter)="enterInto($event, 3)" (stepExit)="exitFrom($event, 3)">
Step 3
</aw-wizard-step>
</aw-wizard>
`
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/wizard-step.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, forwardRef, ViewEncapsulation} from '@angular/core';
import {WizardStep} from '../util';
import {WizardStep} from '../util/wizard-step.interface';

/**
* The `aw-wizard-step` component is used to define a normal step inside a wizard.
Expand Down
20 changes: 13 additions & 7 deletions src/lib/components/wizard.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {AfterViewInit, ChangeDetectorRef, Component, ViewChild} from '@angular/core';
import {WizardComponent} from './wizard.component';
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {ArchwizardModule} from '../archwizard.module';
import {WizardState} from '../navigation/wizard-state.model';
import {FreeNavigationMode} from '../navigation/free-navigation-mode';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {StrictNavigationMode} from '../navigation/strict-navigation-mode';
import {FreeNavigationMode} from '../navigation/free-navigation-mode';
import {WizardState} from '../navigation/wizard-state.model';
import {WizardComponent} from './wizard.component';

@Component({
selector: 'aw-test-wizard',
template: `
<aw-wizard [navigationMode]="navigationMode" [disableNavigationBar]="disableNavigationBar" [defaultStepIndex]="defaultStepIndex">
<aw-wizard-step stepTitle='Steptitle 1' *ngIf="showStep1">Step 1</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2'>Step 2</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3' *ngIf="showStep3">Step 3</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 1' *ngIf="showStep1">
Step 1
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2'>
Step 2
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3' *ngIf="showStep3">
Step 3
</aw-wizard-step>
</aw-wizard>
`
})
Expand Down
21 changes: 11 additions & 10 deletions src/lib/components/wizard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
SimpleChanges,
ViewEncapsulation
} from '@angular/core';
import {NavigationMode, WizardState} from '../navigation';
import {WizardStep} from '../util';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {WizardStep} from '../util/wizard-step.interface';

/**
* The `aw-wizard` component defines the root component of a wizard.
Expand Down Expand Up @@ -101,6 +102,14 @@ export class WizardComponent implements OnChanges, AfterContentInit {
@Input()
public disableNavigationBar = false;

/**
* Constructor
*
* @param model The model for this wizard component
*/
constructor(public model: WizardState) {
}

/**
* Returns true if this wizard uses a horizontal orientation.
* The wizard uses a horizontal orientation, iff the navigation bar is shown at the top or bottom of this wizard
Expand Down Expand Up @@ -130,14 +139,6 @@ export class WizardComponent implements OnChanges, AfterContentInit {
return this.model.navigationMode;
}

/**
* Constructor
*
* @param model The model for this wizard component
*/
constructor(public model: WizardState) {
}

/**
* Updates the model after certain input values have changed
*
Expand Down
15 changes: 6 additions & 9 deletions src/lib/directives/enable-back-links.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
/**
* Created by marc on 30.06.17.
*/
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {Component} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {ArchwizardModule} from '../archwizard.module';
import {WizardState} from '../navigation/wizard-state.model';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {MovingDirection} from '../util/moving-direction.enum';

@Component({
selector: 'aw-test-wizard',
Expand All @@ -16,12 +13,12 @@ import {NavigationMode} from '../navigation/navigation-mode.interface';
<aw-wizard-step stepTitle='Steptitle 1' (stepEnter)="enterInto($event, 1)" (stepExit)="exitFrom($event, 1)">
Step 1
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' [canExit]="isValid"
awOptionalStep (stepEnter)="enterInto($event, 2)" (stepExit)="exitFrom($event, 2)">
<aw-wizard-step stepTitle='Steptitle 2' [canExit]="isValid" awOptionalStep (stepEnter)="enterInto($event, 2)"
(stepExit)="exitFrom($event, 2)">
Step 2
</aw-wizard-step>
<aw-wizard-completion-step awEnableBackLinks stepTitle='Completion steptitle 3' (stepEnter)="enterInto($event, 3)"
(stepExit)="completionStepExit($event, 3)">
(stepExit)="completionStepExit($event, 3)">
Step 3
</aw-wizard-completion-step>
</aw-wizard>
Expand Down
6 changes: 4 additions & 2 deletions src/lib/directives/enable-back-links.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Directive, EventEmitter, Host, OnInit, Output} from '@angular/core';
import {MovingDirection, WizardCompletionStep} from '../util';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';

/**
* The `awEnableBackLinks` directive can be used to allow the user to leave a [[WizardCompletionStep]] after is has been entered.
Expand Down Expand Up @@ -38,7 +39,8 @@ export class EnableBackLinksDirective implements OnInit {
*
* @param completionStep The wizard completion step, which should be exitable
*/
constructor(@Host() private completionStep: WizardCompletionStep) { }
constructor(@Host() private completionStep: WizardCompletionStep) {
}

/**
* Initialization work
Expand Down
31 changes: 20 additions & 11 deletions src/lib/directives/go-to-step.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
/**
* Created by marc on 09.01.17.
*/
import {GoToStepDirective} from './go-to-step.directive';
import {Component} from '@angular/core';
import {async, ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {ArchwizardModule} from '../archwizard.module';
import {WizardState} from '../navigation/wizard-state.model';
import {NavigationMode} from '../navigation/navigation-mode.interface';
import {WizardState} from '../navigation/wizard-state.model';
import {GoToStepDirective} from './go-to-step.directive';

@Component({
selector: 'aw-test-wizard',
template: `
<aw-wizard>
<aw-wizard-step stepTitle='Steptitle 1' [canExit]="canExit">
Step 1
<button type="button" [awGoToStep]="{stepIndex: 0}" (preFinalize)="finalizeStep(1)">Stay at this step</button>
<button type="button" [awGoToStep]="{stepIndex: goToSecondStep}" (preFinalize)="finalizeStep(1)">Go to second step</button>
<button type="button" [awGoToStep]="{stepOffset: 2}" (preFinalize)="finalizeStep(1)">Go to third step</button>
<button type="button" [awGoToStep]="{stepIndex: 0}" (preFinalize)="finalizeStep(1)">
Stay at this step
</button>
<button type="button" [awGoToStep]="{stepIndex: goToSecondStep}" (preFinalize)="finalizeStep(1)">
Go to second step
</button>
<button type="button" [awGoToStep]="{stepOffset: 2}" (preFinalize)="finalizeStep(1)">
Go to third step
</button>
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 2' awOptionalStep>
Step 2
<button type="button" [awGoToStep]="{stepIndex: 2}" (finalize)="finalizeStep(2)">Go to third step</button>
<button type="button" [awGoToStep]="{incorrectKey: 3}" (finalize)="finalizeStep(2)">Invalid Button</button>
<button type="button" [awGoToStep]="{stepIndex: 2}" (finalize)="finalizeStep(2)">
Go to third step
</button>
<button type="button" [awGoToStep]="{incorrectKey: 3}" (finalize)="finalizeStep(2)">
Invalid Button
</button>
</aw-wizard-step>
<aw-wizard-step stepTitle='Steptitle 3'>
Step 3
<button type="button" [awGoToStep]="{stepOffset: -2}" (postFinalize)="finalizeStep(3)">Go to first step</button>
<button type="button" [awGoToStep]="{stepOffset: -2}" (postFinalize)="finalizeStep(3)">
Go to first step
</button>
</aw-wizard-step>
</aw-wizard>
`
Expand Down

0 comments on commit 713d97f

Please sign in to comment.