-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: introduce component for terms and conditions checkbox
- Loading branch information
Showing
6 changed files
with
80 additions
and
23 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
20 changes: 20 additions & 0 deletions
20
src/app/shared/forms/components/tac-checkbox/tac-checkbox.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,20 @@ | ||
<div class="row form-group form-group-tc"> | ||
<div class="offset-md-4 col-md-8"> | ||
<ish-checkbox | ||
[form]="form" | ||
controlName="termsAndConditions" | ||
[errorMessages]="{ pattern: 'registration.tac.error.tip' }" | ||
> | ||
<span | ||
[ishServerHtml]=" | ||
'registration.tac_privacy_policy.text' | ||
| translate | ||
: { | ||
'0': '/page/page.termsAndConditions.pagelet2-Page', | ||
'1': '/page/page.privacyPolicy.pagelet2-Page' | ||
} | ||
" | ||
></span> | ||
</ish-checkbox> | ||
</div> | ||
</div> |
34 changes: 34 additions & 0 deletions
34
src/app/shared/forms/components/tac-checkbox/tac-checkbox.component.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,34 @@ | ||
import { ComponentFixture, TestBed, async } from '@angular/core/testing'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { MockComponent, MockDirective } from 'ng-mocks'; | ||
|
||
import { ServerHtmlDirective } from 'ish-core/directives/server-html.directive'; | ||
import { CheckboxComponent } from 'ish-shared/forms/components/checkbox/checkbox.component'; | ||
|
||
import { TacCheckboxComponent } from './tac-checkbox.component'; | ||
|
||
describe('Tac Checkbox Component', () => { | ||
let component: TacCheckboxComponent; | ||
let fixture: ComponentFixture<TacCheckboxComponent>; | ||
let element: HTMLElement; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ReactiveFormsModule, TranslateModule.forRoot()], | ||
declarations: [MockComponent(CheckboxComponent), MockDirective(ServerHtmlDirective), TacCheckboxComponent], | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TacCheckboxComponent); | ||
component = fixture.componentInstance; | ||
element = fixture.nativeElement; | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
expect(element).toBeTruthy(); | ||
expect(() => fixture.detectChanges()).not.toThrow(); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
src/app/shared/forms/components/tac-checkbox/tac-checkbox.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,11 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { FormGroup } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'ish-tac-checkbox', | ||
templateUrl: './tac-checkbox.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TacCheckboxComponent { | ||
@Input() form: FormGroup; | ||
} |
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