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

Commit

Permalink
Added visual test
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-TrevorBurch committed Nov 20, 2018
1 parent 3887607 commit c0aea83
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
9 changes: 9 additions & 0 deletions e2e/select-field.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ describe('Select field', () => {
expect('#screenshot-select-field-single-mode').toMatchBaselineScreenshot(done);
});

it('should match previous single mode screenshot with validation', (done) => {
element(by.css('#screenshot-select-field-single-mode .sky-input-group.sky-btn')).click();
element(by.css('.sky-modal-btn-close')).click();
SkyHostBrowser.moveCursorOffScreen();
expect('#screenshot-select-field-single-mode-wrapper').toMatchBaselineScreenshot(done, {
screenshotName: 'select-field-single-mode-validation'
});
});

it('should match previous multiple mode selected screenshot', (done) => {
element(by.css('#select-field-populate-selected-btn')).click();
expect('#screenshot-select-field-multiple-mode').toMatchBaselineScreenshot(done);
Expand Down
5 changes: 3 additions & 2 deletions src/app/public/modules/select-field/select-field.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export class SkySelectFieldComponent implements ControlValueAccessor {
this.writeValue(result.data);
}
}
this.onTouched();
});
});
}
Expand All @@ -197,9 +198,9 @@ export class SkySelectFieldComponent implements ControlValueAccessor {

// Angular automatically constructs these methods.
/* istanbul ignore next */
public onChange = (value: any) => {};
public onChange = (value: any) => { };
/* istanbul ignore next */
public onTouched = () => {};
public onTouched = () => { };

public registerOnChange(fn: (value: any) => void) {
this.onChange = fn;
Expand Down
20 changes: 12 additions & 8 deletions src/app/visual/select-field/select-field-visual.component.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

<div id="screenshot-select-field-single-mode">
<sky-select-field
selectMode="single"
name="single"
[ngModel]="model.single"
[data]="data">
</sky-select-field>
<br/>
<div id="screenshot-select-field-single-mode-wrapper" style="padding: 5px 0;">
<div id="screenshot-select-field-single-mode">
<sky-select-field
selectMode="single"
name="single"
[ngModel]="model.single"
[data]="data"
required>
</sky-select-field>
</div>
</div>
<br/>
<div id="screenshot-select-field-multiple-mode">
<sky-select-field
selectMode="multiple"
Expand Down
4 changes: 3 additions & 1 deletion src/app/visual/select-field/select-field-visual.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
Component
} from '@angular/core';

import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import {
BehaviorSubject
} from 'rxjs/BehaviorSubject';

@Component({
selector: 'select-field-visual',
Expand Down

0 comments on commit c0aea83

Please sign in to comment.