mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-16 11:49:06 -04:00
Some checks are pending
/ release (push) Waiting to run
testing-integration / test-unit (push) Waiting to run
testing-integration / test-sqlite (push) Waiting to run
testing-integration / test-mariadb (v10.6) (push) Waiting to run
testing-integration / test-mariadb (v11.8) (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/10556 This is a followup to !10524. In addition I changed that the tooltip triggers for the whole height, instead for only the bar height, because otherwise it is esp for small bars nearly impossible to get the tooltip to open. Co-authored-by: Beowulf <beowulf@beocode.eu> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10628 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
28 lines
1,020 B
JavaScript
28 lines
1,020 B
JavaScript
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import {flushPromises, mount} from '@vue/test-utils';
|
|
import RepoActivityTopAuthors from './RepoActivityTopAuthors.vue';
|
|
import {expect, test, vi} from 'vitest';
|
|
|
|
test('calc image size and shift', async () => {
|
|
vi.spyOn(RepoActivityTopAuthors.methods, 'init').mockResolvedValue({});
|
|
|
|
const repoActivityTopAuthors = mount(RepoActivityTopAuthors, {
|
|
props: {
|
|
locale: {
|
|
commitActivity: '',
|
|
},
|
|
},
|
|
});
|
|
await flushPromises();
|
|
|
|
const square = repoActivityTopAuthors.vm.calcImageSizeAndShift({naturalWidth: 50, naturalHeight: 50});
|
|
expect(square).toEqual([20, 20, 0, 0]);
|
|
|
|
const portrait = repoActivityTopAuthors.vm.calcImageSizeAndShift({naturalWidth: 5, naturalHeight: 50});
|
|
expect(portrait).toEqual([2, 20, 9, 0]);
|
|
|
|
const landscape = repoActivityTopAuthors.vm.calcImageSizeAndShift({naturalWidth: 500, naturalHeight: 5});
|
|
expect(landscape).toEqual([20, 0.2, 0, 9.9]);
|
|
});
|