This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added sectioned form component (#1068)
- Loading branch information
1 parent
b263086
commit ed60298
Showing
64 changed files
with
1,757 additions
and
147 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
11 changes: 11 additions & 0 deletions
11
skyux-spa-visual-tests/src/app/sectioned-form/demo-address-form.component.html
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,11 @@ | ||
<div class="sky-emphasized" style="margin-bottom: 5px;"> | ||
<label>Home</label> | ||
</div> | ||
<div>410 17th Street</div> | ||
<div>Denver, CO 80202-4402</div> | ||
|
||
<div class="sky-emphasized" style="margin: 5px 0 5px 0;"> | ||
<label>Vacation</label> | ||
</div> | ||
<div>3345 Franciscan Way</div> | ||
<div>Tampa, FL 10255-0098</div> |
7 changes: 7 additions & 0 deletions
7
skyux-spa-visual-tests/src/app/sectioned-form/demo-address-form.component.ts
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,7 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-demo-address-form', | ||
templateUrl: './demo-address-form.component.html' | ||
}) | ||
export class SkyDemoAddressFormComponent {} |
41 changes: 41 additions & 0 deletions
41
skyux-spa-visual-tests/src/app/sectioned-form/demo-information-form.component.html
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,41 @@ | ||
<div style="display: flex;"> | ||
<div style="margin-right: 10px; flex: 1;"> | ||
<label | ||
for="inputName" | ||
class="sky-control-label" | ||
[ngClass]="{'sky-control-label-required': nameRequired}" | ||
> | ||
Name | ||
</label> | ||
<input | ||
class="sky-form-control" | ||
[ngModel]="name" | ||
(ngModelChange)="nameChange($event)" | ||
id="inputName" | ||
type="text" | ||
> | ||
</div> | ||
<div style="margin-right: 10px; flex: 1;"> | ||
<label | ||
for="inputId" | ||
class="sky-control-label" | ||
> | ||
Id | ||
</label> | ||
<input | ||
class="sky-form-control" | ||
[ngModel]="id" | ||
id="inputId" | ||
type="text" | ||
> | ||
</div> | ||
</div> | ||
|
||
<div style="margin-top: 10px;"> | ||
<sky-checkbox [(ngModel)]="nameRequired"> | ||
<sky-checkbox-label> | ||
Mark 'Name' required | ||
</sky-checkbox-label> | ||
</sky-checkbox> | ||
</div> | ||
|
37 changes: 37 additions & 0 deletions
37
skyux-spa-visual-tests/src/app/sectioned-form/demo-information-form.component.ts
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,37 @@ | ||
import { Component, Output, EventEmitter } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-demo-information-form', | ||
templateUrl: './demo-information-form.component.html' | ||
}) | ||
export class SkyDemoInformationFormComponent { | ||
public name: string = ''; | ||
public id: string = '5324901'; | ||
|
||
@Output() | ||
public requiredChange = new EventEmitter<boolean>(); | ||
|
||
private _nameRequired: boolean = false; | ||
|
||
public get nameRequired() { | ||
return this._nameRequired; | ||
} | ||
|
||
public set nameRequired(value: boolean) { | ||
this._nameRequired = value; | ||
this.emitRequiredChange(); | ||
} | ||
|
||
public nameChange(newName: string) { | ||
this.name = newName; | ||
this.emitRequiredChange(); | ||
} | ||
|
||
private emitRequiredChange() { | ||
if (this.nameRequired && !this.name) { | ||
this.requiredChange.emit(true); | ||
} else { | ||
this.requiredChange.emit(false); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
skyux-spa-visual-tests/src/app/sectioned-form/demo-phone-form.component.html
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,11 @@ | ||
<div> | ||
<div> | ||
<span class="sky-emphasized">Home</span> 303.997.3301 | ||
</div> | ||
<div> | ||
<span class="sky-emphasized">Mobile</span> 888.387.1211 | ||
</div> | ||
<div> | ||
<span class="sky-emphasized">Work</span> 303.997.2000 | ||
</div> | ||
</div> |
7 changes: 7 additions & 0 deletions
7
skyux-spa-visual-tests/src/app/sectioned-form/demo-phone-form.component.ts
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,7 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-demo-phone-form', | ||
templateUrl: './demo-phone-form.component.html' | ||
}) | ||
export class SkyDemoPhoneFormComponent {} |
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 @@ | ||
<sectioned-form-visual></sectioned-form-visual> |
15 changes: 15 additions & 0 deletions
15
skyux-spa-visual-tests/src/app/sectioned-form/sectioned-form-visual.component.html
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,15 @@ | ||
<div id="screenshot-sectioned-form" style="padding-left: 15px;"> | ||
<sky-sectioned-form> | ||
<sky-sectioned-form-section heading="Basic information"> | ||
<sky-demo-information-form > | ||
</sky-demo-information-form> | ||
</sky-sectioned-form-section> | ||
<sky-sectioned-form-section heading="Addresses" itemCount="2" active="true"> | ||
<sky-demo-address-form></sky-demo-address-form> | ||
</sky-sectioned-form-section> | ||
<sky-sectioned-form-section heading="Phone numbers" itemCount="3"> | ||
<sky-demo-phone-form></sky-demo-phone-form> | ||
</sky-sectioned-form-section> | ||
</sky-sectioned-form> | ||
</div> | ||
|
8 changes: 8 additions & 0 deletions
8
skyux-spa-visual-tests/src/app/sectioned-form/sectioned-form-visual.component.ts
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,8 @@ | ||
import { ChangeDetectionStrategy, Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sectioned-form-visual', | ||
templateUrl: './sectioned-form-visual.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class SectionedFormVisualComponent {} |
91 changes: 91 additions & 0 deletions
91
skyux-spa-visual-tests/src/app/sectioned-form/sectioned-form.visual-spec.ts
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,91 @@ | ||
import { SkyVisualTest } from '../../../config/utils/visual-test-commands'; | ||
import { element, by, browser } from 'protractor'; | ||
|
||
describe('Sectioned form', () => { | ||
|
||
it('should match previous sectioned form screenshot', () => { | ||
return SkyVisualTest.setupTest('sectioned-form') | ||
.then(() => { | ||
return SkyVisualTest.compareScreenshot({ | ||
screenshotName: 'sectioned-form', | ||
selector: '#screenshot-sectioned-form' | ||
}); | ||
}); | ||
}); | ||
|
||
it('should match previous sectioned form screenshot after clicking first tab', () => { | ||
return SkyVisualTest.setupTest('sectioned-form') | ||
.then(() => { | ||
|
||
let tabs = element.all(by.css('sky-vertical-tab')); | ||
|
||
// click first tab | ||
tabs.get(0).click(); | ||
|
||
return SkyVisualTest.compareScreenshot({ | ||
screenshotName: 'sectioned-form-first', | ||
selector: '#screenshot-sectioned-form' | ||
}); | ||
}); | ||
}); | ||
|
||
it('should match previous sectioned form screenshot after clicking second tab', () => { | ||
return SkyVisualTest.setupTest('sectioned-form') | ||
.then(() => { | ||
|
||
let tabs = element.all(by.css('sky-vertical-tab')); | ||
|
||
// click second tab | ||
tabs.get(1).click(); | ||
|
||
return SkyVisualTest.compareScreenshot({ | ||
screenshotName: 'sectioned-form-second', | ||
selector: '#screenshot-sectioned-form' | ||
}); | ||
}); | ||
}); | ||
|
||
it('should match previous sectioned form screenshot on mobile', () => { | ||
return SkyVisualTest.setupTest('sectioned-form', 480) | ||
.then(() => { | ||
return SkyVisualTest.compareScreenshot({ | ||
screenshotName: 'sectioned-form-mobile', | ||
selector: '#screenshot-sectioned-form' | ||
}); | ||
}); | ||
}); | ||
|
||
it('should match previous sectioned form screenshot after resizing to mobile', () => { | ||
return SkyVisualTest.setupTest('sectioned-form') | ||
.then(() => { | ||
|
||
// resize to mobile | ||
browser.driver.manage().window().setSize(480, 800); | ||
browser.sleep(1000); | ||
|
||
return SkyVisualTest.compareScreenshot({ | ||
screenshotName: 'sectioned-form-to-mobile', | ||
selector: '#screenshot-sectioned-form' | ||
}); | ||
}); | ||
}); | ||
|
||
it('should match previous sectioned form screenshot after resizing to widescreen', () => { | ||
return SkyVisualTest.setupTest('sectioned-form') | ||
.then(() => { | ||
|
||
// resize to mobile | ||
browser.driver.manage().window().setSize(480, 800); | ||
browser.sleep(1000); | ||
|
||
// resize to widescreen | ||
browser.driver.manage().window().setSize(1000, 800); | ||
browser.sleep(1000); | ||
|
||
return SkyVisualTest.compareScreenshot({ | ||
screenshotName: 'sectioned-form-to-widescreen', | ||
selector: '#screenshot-sectioned-form' | ||
}); | ||
}); | ||
}); | ||
}); |
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
11 changes: 11 additions & 0 deletions
11
src/app/components/sectioned-form/demo-address-form.component.html
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,11 @@ | ||
<div class="sky-emphasized" style="margin-bottom: 5px;"> | ||
<label>Home</label> | ||
</div> | ||
<div>410 17th Street</div> | ||
<div>Denver, CO 80202-4402</div> | ||
|
||
<div class="sky-emphasized" style="margin: 5px 0 5px 0;"> | ||
<label>Vacation</label> | ||
</div> | ||
<div>3345 Franciscan Way</div> | ||
<div>Tampa, FL 10255-0098</div> |
7 changes: 7 additions & 0 deletions
7
src/app/components/sectioned-form/demo-address-form.component.ts
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,7 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-demo-address-form', | ||
templateUrl: './demo-address-form.component.html' | ||
}) | ||
export class SkyDemoAddressFormComponent {} |
Oops, something went wrong.