Skip to content

Commit 9dd125b

Browse files
committed
- fixing used codestyle
- improving css in the wizard component and the wizard-step component - adding travis badge to README
1 parent 6b721b1 commit 9dd125b

22 files changed

+66
-61
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Ng2Wizard
22

3+
[![Build Status](https://travis-ci.org/madoar/ng2-wizard.png)](https://travis-ci.org/madoar/ng2-wizard)
4+
35
This project contains a functional wizard component for [Angular 2](https://angular.io/).
46

57
## Build

src/components/components/wizard-navigation-bar.component.less

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
@wz-color-editing: #FF0000;
66

77
.steps-indicator {
8-
/* ---- steps quantity ---- */
9-
right: 0;
10-
bottom: 0;
11-
left: 0;
12-
margin: 0;
13-
padding: 20px 0 0 0;
14-
height: auto;
15-
padding-bottom: 10px;
16-
overflow: hidden;
178
list-style: none;
189

1910
&:before {

src/components/components/wizard-navigation-bar.component.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/* tslint:disable:no-unused-variable */
22
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
3-
import {By} from '@angular/platform-browser';
43
import {DebugElement, QueryList} from '@angular/core';
54

65
import {WizardNavigationBarComponent} from './wizard-navigation-bar.component';
7-
import {WizardComponent} from "./wizard.component";
8-
import {WizardStepComponent} from "./wizard-step.component";
9-
import {GoToStepDirective} from "../directives/go-to-step.directive";
6+
import {WizardComponent} from './wizard.component';
7+
import {WizardStepComponent} from './wizard-step.component';
8+
import {GoToStepDirective} from '../directives/go-to-step.directive';
109

1110
describe('WizardNavigationBarComponent', () => {
1211
let component: WizardNavigationBarComponent;

src/components/components/wizard-navigation-bar.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {Component, QueryList} from "@angular/core";
2-
import {WizardComponent} from "./wizard.component";
3-
import {WizardStepComponent} from "./wizard-step.component";
1+
import {Component, QueryList} from '@angular/core';
2+
import {WizardComponent} from './wizard.component';
3+
import {WizardStepComponent} from './wizard-step.component';
44

55
@Component({
66
selector: 'wizard-navigation-bar',

src/components/components/wizard-step.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* tslint:disable:no-unused-variable */
22
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3-
import { By } from '@angular/platform-browser';
4-
import { DebugElement } from '@angular/core';
53

64
import { WizardStepComponent } from './wizard-step.component';
75

src/components/components/wizard-step.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {Component, Input, Output, EventEmitter} from "@angular/core";
2-
import {MovingDirection} from "../util/MovingDirection";
1+
import {Component, Input, Output, EventEmitter} from '@angular/core';
2+
import {MovingDirection} from '../util/MovingDirection';
33

44
@Component({
55
selector: 'wizard-step',

src/components/components/wizard.component.css

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div class="wizard-centered">
2-
<wizard-navigation-bar *ngIf="navBarLocation == 'top'"></wizard-navigation-bar>
2+
<wizard-navigation-bar *ngIf="navBarLocation == 'top'" [ngClass]="['nav-bar', 'top']"></wizard-navigation-bar>
33

44
<div class="steps">
55
<ng-content></ng-content>
66
</div>
77

8-
<wizard-navigation-bar *ngIf="navBarLocation == 'bottom'"></wizard-navigation-bar>
8+
<wizard-navigation-bar *ngIf="navBarLocation == 'bottom'" [ngClass]="['nav-bar', 'bottom']"></wizard-navigation-bar>
99
</div>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.wizard-centered {
2+
text-align: center;
3+
margin: 0 auto;
4+
5+
.nav-bar {
6+
right: 0;
7+
bottom: 0;
8+
left: 0;
9+
margin: 0;
10+
width: 100%;
11+
height: auto;
12+
overflow: hidden;
13+
14+
&.top {
15+
padding-bottom: 10px;
16+
}
17+
18+
&.bottom {
19+
padding-top: 10px;
20+
}
21+
}
22+
}

src/components/components/wizard.component.spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/* tslint:disable:no-unused-variable */
2-
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
3-
import {QueryList, Component, ViewChild} from "@angular/core";
4-
import {WizardComponent} from "./wizard.component";
5-
import {WizardStepComponent} from "./wizard-step.component";
6-
import {WizardNavigationBarComponent} from "./wizard-navigation-bar.component";
7-
import {GoToStepDirective} from "../directives/go-to-step.directive";
2+
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
3+
import {QueryList, Component, ViewChild} from '@angular/core';
4+
import {WizardComponent} from './wizard.component';
5+
import {WizardStepComponent} from './wizard-step.component';
6+
import {WizardNavigationBarComponent} from './wizard-navigation-bar.component';
7+
import {GoToStepDirective} from '../directives/go-to-step.directive';
88

99
@Component({
10-
selector: "test-wizard",
10+
selector: 'test-wizard',
1111
template: `
1212
<wizard>
13-
<wizard-step title="Steptitle 1">Step 1</wizard-step>
14-
<wizard-step title="Steptitle 2">Step 2</wizard-step>
15-
<wizard-step title="Steptitle 3">Step 3</wizard-step>
13+
<wizard-step title='Steptitle 1'>Step 1</wizard-step>
14+
<wizard-step title='Steptitle 2'>Step 2</wizard-step>
15+
<wizard-step title='Steptitle 3'>Step 3</wizard-step>
1616
</wizard>
1717
`
1818
})
@@ -24,7 +24,7 @@ class WizardTestComponent {
2424
function checkWizardSteps(steps: QueryList<WizardStepComponent>, selectedStepIndex: number) {
2525
steps.forEach((step, index, array) => {
2626
// Only the selected step should be selected
27-
if (index == selectedStepIndex) {
27+
if (index === selectedStepIndex) {
2828
expect(step.selected).toBe(true, `the selected wizard step index ${index} is not selected`);
2929
} else {
3030
expect(step.selected).toBe(false, `the not selected wizard step index ${index} is selected`);
@@ -66,17 +66,17 @@ describe('WizardComponent', () => {
6666

6767
it('should start at first step', () => {
6868
expect(wizardTest.wizard.currentStepIndex).toBe(0);
69-
expect(wizardTest.wizard.currentStep.title).toBe("Steptitle 1");
69+
expect(wizardTest.wizard.currentStep.title).toBe('Steptitle 1');
7070

7171
checkWizardSteps(wizardTest.wizard.wizardSteps, 0);
7272
});
7373

7474
it('should return correct step at index', () => {
7575
expect(() => wizardTest.wizard.getStepAtIndex(-1)).toThrow(new Error(`Expected a known step, but got stepIndex: -1.`));
7676

77-
expect(wizardTest.wizard.getStepAtIndex(0).title).toBe("Steptitle 1");
78-
expect(wizardTest.wizard.getStepAtIndex(1).title).toBe("Steptitle 2");
79-
expect(wizardTest.wizard.getStepAtIndex(2).title).toBe("Steptitle 3");
77+
expect(wizardTest.wizard.getStepAtIndex(0).title).toBe('Steptitle 1');
78+
expect(wizardTest.wizard.getStepAtIndex(1).title).toBe('Steptitle 2');
79+
expect(wizardTest.wizard.getStepAtIndex(2).title).toBe('Steptitle 3');
8080

8181
// Check that the first wizard step is the only selected one
8282
checkWizardSteps(wizardTest.wizard.wizardSteps, 0);
@@ -179,7 +179,7 @@ describe('WizardComponent', () => {
179179
wizardTestFixture.detectChanges();
180180

181181
expect(wizardTest.wizard.currentStepIndex).toBe(1);
182-
expect(wizardTest.wizard.currentStep.title).toBe("Steptitle 2");
182+
expect(wizardTest.wizard.currentStep.title).toBe('Steptitle 2');
183183
expect(wizardTest.wizard.currentStep.completed).toBe(false);
184184

185185
checkWizardSteps(wizardTest.wizard.wizardSteps, 1);

0 commit comments

Comments
 (0)