Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Changed select field error state to on touched for consistency #38

Merged
merged 5 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions e2e/validation.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
by,
element
} from 'protractor';

import {
expect,
SkyHostBrowser
} from '@skyux-sdk/e2e';

describe('Validation', () => {

beforeEach(() => {
SkyHostBrowser.get('visual/validation');
SkyHostBrowser.setWindowBreakpoint('lg');
});

it('should match the text input required screenshot', (done) => {
// Click on input
element(by.css('#text-input input')).click();
// Click off input
element(by.css('#select-input select')).click();
expect('#text-input')
.toMatchBaselineScreenshot(done, {
screenshotName: 'standard-input-validation'
});
});

it('should match the select input required screenshot', (done) => {
// Click on select
element(by.css('#select-input select')).click();
// Click off select
element(by.css('#text-input input')).click();
expect('#select-input')
.toMatchBaselineScreenshot(done, {
screenshotName: 'select-validation'
});
});

});
3 changes: 3 additions & 0 deletions src/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
<li>
<a href="#" skyAppLink="/visual/inputs">Native form controls</a>
</li>
<li>
<a href="#" skyAppLink="/visual/validation">Validation</a>
</li>
</ul>
2 changes: 1 addition & 1 deletion src/app/public/styles/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

input.ng-invalid.ng-touched,
select.ng-invalid.submitted {
select.ng-invalid.ng-touched {
Blackbaud-TrevorBurch marked this conversation as resolved.
Show resolved Hide resolved
@include sky-field-status(invalid);
}

Expand Down
1 change: 1 addition & 0 deletions src/app/visual/validation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<sky-validation-demo></sky-validation-demo>
12 changes: 12 additions & 0 deletions src/app/visual/validation/validation-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div id="text-input">
<label for="textInput" class="sky-control-label sky-control-label-required">
Text Input
</label>
<input type="text" name="textInput" [(ngModel)]="textInput" class="sky-form-control" required>
</div>
<div id="select-input">
<select [(ngModel)]="selectInput" class="sky-form-control" required>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</div>
5 changes: 5 additions & 0 deletions src/app/visual/validation/validation-demo.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#text-input, #select-input {
width: 95%;
margin: 10px;
padding: 10px;
}
15 changes: 15 additions & 0 deletions src/app/visual/validation/validation-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
Component
} from '@angular/core';

@Component({
selector: 'sky-validation-demo',
templateUrl: './validation-demo.component.html',
styleUrls: ['./validation-demo.component.scss']
})
export class SkyValidationDemoComponent {

public textInput: string;
public selectInput: string;

}