Commit a600dbbe authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch...

Merge branch '228997-replace-vue_shared-tooltip-with-gitlab-ui-s-tooltip-in-app-assets-javascripts' into 'master'

Migrate MR merged/closed time tooltip to GitLab UI

See merge request gitlab-org/gitlab!45137
parents 2d7b79bf af250f0d
<script> <script>
import tooltip from '~/vue_shared/directives/tooltip'; import { GlTooltipDirective } from '@gitlab/ui';
import MrWidgetAuthor from './mr_widget_author.vue'; import MrWidgetAuthor from './mr_widget_author.vue';
export default { export default {
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
MrWidgetAuthor, MrWidgetAuthor,
}, },
directives: { directives: {
tooltip, GlTooltip: GlTooltipDirective,
}, },
props: { props: {
actionText: { actionText: {
...@@ -34,6 +34,7 @@ export default { ...@@ -34,6 +34,7 @@ export default {
<h4 class="js-mr-widget-author"> <h4 class="js-mr-widget-author">
{{ actionText }} {{ actionText }}
<mr-widget-author :author="author" /> <mr-widget-author :author="author" />
<time v-tooltip :title="dateTitle" data-container="body"> {{ dateReadable }} </time> <span class="sr-only">{{ dateReadable }} ({{ dateTitle }})</span>
<time v-gl-tooltip.hover aria-hidden :title="dateTitle"> {{ dateReadable }} </time>
</h4> </h4>
</template> </template>
...@@ -35,9 +35,7 @@ describe('MrWidgetAuthorTime', () => { ...@@ -35,9 +35,7 @@ describe('MrWidgetAuthorTime', () => {
}); });
it('renders provided time', () => { it('renders provided time', () => {
expect(vm.$el.querySelector('time').getAttribute('data-original-title')).toEqual( expect(vm.$el.querySelector('time').getAttribute('title')).toEqual('2017-03-23T23:02:00.807Z');
'2017-03-23T23:02:00.807Z',
);
expect(vm.$el.querySelector('time').textContent.trim()).toEqual('12 hours ago'); expect(vm.$el.querySelector('time').textContent.trim()).toEqual('12 hours ago');
}); });
......
...@@ -212,8 +212,6 @@ describe('MRWidgetMerged', () => { ...@@ -212,8 +212,6 @@ describe('MRWidgetMerged', () => {
}); });
it('should use mergedEvent mergedAt as tooltip title', () => { it('should use mergedEvent mergedAt as tooltip title', () => {
expect(vm.$el.querySelector('time').getAttribute('data-original-title')).toBe( expect(vm.$el.querySelector('time').getAttribute('title')).toBe('Jan 24, 2018 1:02pm GMT+0000');
'Jan 24, 2018 1:02pm GMT+0000',
);
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment