-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Provide ability to define step navigation symbol in the form of Angular template. For example: ``` <div awWizardStep> <ng-template awWizardStepTitle> Address information </ng-template> <ng-template awWizardStepSymbol> <i class="fa fa-taxi"></i> </ng-template> </div> ``` TODO: - Document in the main README.md - Add an example in the [demo app](https://github.com/madoar/angular-archwizard-demo/) * Rewrite HTML template more concisely
- Loading branch information
Showing
7 changed files
with
119 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import {ViewChild, Component} from '@angular/core'; | ||
import {TestBed, async, ComponentFixture} from '@angular/core/testing'; | ||
import {By} from '@angular/platform-browser'; | ||
|
||
import {WizardComponent} from '../components/wizard.component'; | ||
import {ArchwizardModule} from '../archwizard.module'; | ||
|
||
|
||
@Component({ | ||
selector: 'aw-test-wizard', | ||
template: ` | ||
<aw-wizard> | ||
<aw-wizard-step stepTitle='Step A'> | ||
<ng-template awWizardStepSymbol>A</ng-template> | ||
Step A content | ||
</aw-wizard-step> | ||
<aw-wizard-completion-step stepTitle='Step B'> | ||
<ng-template awWizardStepSymbol>B</ng-template> | ||
Step B content | ||
</aw-wizard-completion-step> | ||
</aw-wizard> | ||
` | ||
}) | ||
class WizardTestComponent { | ||
@ViewChild(WizardComponent) | ||
public wizard: WizardComponent; | ||
} | ||
|
||
describe('WizardStepSymbolDirective', () => { | ||
let wizardTest: WizardTestComponent; | ||
let wizardTestFixture: ComponentFixture<WizardTestComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [WizardTestComponent], | ||
imports: [ArchwizardModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
wizardTestFixture = TestBed.createComponent(WizardTestComponent); | ||
wizardTestFixture.detectChanges(); | ||
|
||
wizardTest = wizardTestFixture.componentInstance; | ||
}); | ||
|
||
it('should create an instance', () => { | ||
let navigationSymbols = wizardTestFixture.debugElement.queryAll(By.css('aw-wizard-navigation-bar ul li .step-indicator')); | ||
|
||
expect(navigationSymbols.length).toBe(2); | ||
expect(navigationSymbols[0].nativeElement.innerText).toBe('A'); | ||
expect(navigationSymbols[1].nativeElement.innerText).toBe('B'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {Directive, TemplateRef} from '@angular/core'; | ||
|
||
/** | ||
* The `awWizardStepSymbol` directive can be used as an alternative to the `navigationSymbol` input of a [[WizardStep]] | ||
* to define the step symbol inside the navigation bar. This way step symbol may contain arbitrary content. | ||
* | ||
* ### Syntax | ||
* | ||
* ```html | ||
* <ng-template awWizardStepSymbol> | ||
* ... | ||
* </ng-template> | ||
* ``` | ||
*/ | ||
@Directive({ | ||
selector: 'ng-template[awStepSymbol], ng-template[awWizardStepSymbol]' | ||
}) | ||
export class WizardStepSymbolDirective { | ||
/** | ||
* Constructor | ||
* | ||
* @param templateRef A reference to the content of the `ng-template` that contains this [[WizardStepSymbolDirective]] | ||
*/ | ||
constructor(public templateRef: TemplateRef<any>) { } | ||
} |
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
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