jsunit: harden avatar tests to pass with fractional scaling of elements

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-12-29 08:35:09 +01:00
parent 1bb81f8f11
commit be38b924d1
1 changed files with 8 additions and 8 deletions

View File

@ -38,8 +38,8 @@ describe('jquery.avatar tests', function() {
it('undefined', function() { it('undefined', function() {
$div.avatar('foo'); $div.avatar('foo');
expect($div.height()).toEqual(64); expect(Math.round($div.height())).toEqual(64);
expect($div.width()).toEqual(64); expect(Math.round($div.width())).toEqual(64);
}); });
it('undefined but div has height', function() { it('undefined but div has height', function() {
@ -49,8 +49,8 @@ describe('jquery.avatar tests', function() {
expect(window.Image).toHaveBeenCalled(); expect(window.Image).toHaveBeenCalled();
window.Image().onerror(); window.Image().onerror();
expect($div.height()).toEqual(9); expect(Math.round($div.height())).toEqual(9);
expect($div.width()).toEqual(9); expect(Math.round($div.width())).toEqual(9);
}); });
it('undefined but data size is set', function() { it('undefined but data size is set', function() {
@ -60,8 +60,8 @@ describe('jquery.avatar tests', function() {
expect(window.Image).toHaveBeenCalled(); expect(window.Image).toHaveBeenCalled();
window.Image().onerror(); window.Image().onerror();
expect($div.height()).toEqual(10); expect(Math.round($div.height())).toEqual(10);
expect($div.width()).toEqual(10); expect(Math.round($div.width())).toEqual(10);
}); });
@ -71,8 +71,8 @@ describe('jquery.avatar tests', function() {
expect(window.Image).toHaveBeenCalled(); expect(window.Image).toHaveBeenCalled();
window.Image().onerror(); window.Image().onerror();
expect($div.height()).toEqual(8); expect(Math.round($div.height())).toEqual(8);
expect($div.width()).toEqual(8); expect(Math.round($div.width())).toEqual(8);
}); });
}); });