Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-26 12:10:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-26 12:10:05 +0300
commit6f22c85c38b7a896178879172f4c0f82353308f8 (patch)
tree7b03dd7282e3b05f9ee8c78c50f52bec97bfc450 /spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
parent8759459c84757589002830279dfe3872ffc852bd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/time_ago_tooltip_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/time_ago_tooltip_spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/time_ago_tooltip_spec.js b/spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
index a1757952dc0..17a363ad8b1 100644
--- a/spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
+++ b/spec/frontend/vue_shared/components/time_ago_tooltip_spec.js
@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import timezoneMock from 'timezone-mock';
import { formatDate, getTimeago } from '~/lib/utils/datetime_utility';
+import { DATE_ONLY_FORMAT } from '~/lib/utils/datetime/constants';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
describe('Time ago with tooltip component', () => {
@@ -49,12 +50,36 @@ describe('Time ago with tooltip component', () => {
expect(vm.attributes('datetime')).toEqual(timestamp);
});
+ it('should render with the timestamp provided as Date', () => {
+ buildVm({ time: new Date(timestamp) });
+
+ expect(vm.text()).toEqual(timeAgoTimestamp);
+ });
+
it('should render provided scope content with the correct timeAgo string', () => {
buildVm(null, { default: `<span>The time is {{ props.timeAgo }}</span>` });
expect(vm.text()).toEqual(`The time is ${timeAgoTimestamp}`);
});
+ describe('with User Setting timeDisplayRelative: false', () => {
+ beforeEach(() => {
+ window.gon = { time_display_relative: false };
+ });
+
+ it('should render with the correct absolute datetime in the default format', () => {
+ buildVm();
+
+ expect(vm.text()).toEqual('May 8, 2017, 2:57 PM');
+ });
+
+ it('should render with the correct absolute datetime in the requested dateTimeFormat', () => {
+ buildVm({ dateTimeFormat: DATE_ONLY_FORMAT });
+
+ expect(vm.text()).toEqual('May 8, 2017');
+ });
+ });
+
describe('number based timestamps', () => {
// Store a date object before we mock the TZ
const date = new Date();