Add + fix tests

This commit is contained in:
Roman Hotsiy 2016-08-31 23:51:56 +03:00
parent a8d98b127b
commit 4066362ab9
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 18 additions and 3 deletions

View File

@ -21,7 +21,7 @@
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}} title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span> <span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
</span> </span>
<span *ngIf="prop['x-nullable']" class="param-nullable">Nullable</span> <span *ngIf="schema['x-nullable']" class="param-nullable">Nullable</span>
<div *ngIf="schema.enum" class="param-enum"> <div *ngIf="schema.enum" class="param-enum">
<span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span> <span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div> </div>

View File

@ -27,10 +27,23 @@ describe('Common components', () => {
expect(component).not.toBeNull(); expect(component).not.toBeNull();
}); });
it('should start sticked', () => { it('should start unsticked', () => {
spyOn(component, 'stick').and.callThrough(); spyOn(component, 'stick').and.callThrough();
spyOn(component, 'stickBottom').and.callThrough();
fixture.detectChanges(); fixture.detectChanges();
expect(component.stick).not.toHaveBeenCalled();
expect(component.stickBottom).not.toHaveBeenCalled();
});
it('should stick to the top on the next VM tick', (done) => {
spyOn(component, 'stick').and.callThrough();
spyOn(component, 'stickBottom').and.callThrough();
fixture.detectChanges();
setTimeout(() => {
expect(component.stick).toHaveBeenCalled(); expect(component.stick).toHaveBeenCalled();
expect(component.stickBottom).toHaveBeenCalled();
done();
});
}); });
it('should stick if scrolled more than scrollYOffset', () => { it('should stick if scrolled more than scrollYOffset', () => {
@ -42,6 +55,8 @@ describe('Common components', () => {
component.updatePosition(); component.updatePosition();
expect(component.stick).toHaveBeenCalled(); expect(component.stick).toHaveBeenCalled();
}); });
// TODO: add tests for stickBottom
}); });
}); });