Created
May 20, 2018 13:00
-
-
Save realtomaszkula/cb3b927d3a8306102b15ac20f3d8ebf2 to your computer and use it in GitHub Desktop.
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
describe('PriceRangeComponent', () => { | |
let component: PriceRangeComponent; | |
let fixture: ComponentFixture<PriceRangeComponent>; | |
let startCtrl: FormControl; | |
let endCtrl: FormControl; | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [PriceRangeModule, NoopAnimationsModule] | |
}).compileComponents(); | |
})); | |
beforeEach(() => { | |
fixture = TestBed.createComponent(PriceRangeComponent); | |
component = fixture.componentInstance; | |
fixture.detectChanges(); | |
const { form } = component; | |
startCtrl = form.get('rangeStart') as FormControl; | |
endCtrl = form.get('rangeEnd') as FormControl; | |
}); | |
it(`rangeEnd should match the rangeStart if rangeStart is increased above rangeEnd's value`, () => { | |
expect(startCtrl.value).toBe(0); | |
expect(endCtrl.value).toBe(0); | |
startCtrl.setValue(100); | |
expect(endCtrl.value).toBe(100); | |
}); | |
it(`rangeStart should match the rangeEnd if rangeEnd is decreased below rangeStart's value`, () => { | |
expect(startCtrl.value).toBe(0); | |
expect(endCtrl.value).toBe(0); | |
startCtrl.setValue(100); | |
endCtrl.setValue(50); | |
expect(startCtrl.value).toBe(50); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment