Commit 0f0818d0 authored by Tim Zallmann's avatar Tim Zallmann

Fixes rerendering of the page when issue loaded

Adds the title-container for issue title
Only animates issue description on second change
Fixes the pinned links if there are none to show
parent cf392444
...@@ -48,11 +48,16 @@ export default { ...@@ -48,11 +48,16 @@ export default {
return { return {
preAnimation: false, preAnimation: false,
pulseAnimation: false, pulseAnimation: false,
initialUpdate: true,
}; };
}, },
watch: { watch: {
descriptionHtml() { descriptionHtml(newDescription, oldDescription) {
this.animateChange(); if (!this.initialUpdate && newDescription !== oldDescription) {
this.animateChange();
} else {
this.initialUpdate = false;
}
this.$nextTick(() => { this.$nextTick(() => {
this.renderGFM(); this.renderGFM();
......
...@@ -20,20 +20,25 @@ export default { ...@@ -20,20 +20,25 @@ export default {
}, },
computed: { computed: {
pinnedLinks() { pinnedLinks() {
return [ const links = [];
{ if (this.publishedIncidentUrl) {
links.push({
id: 'publishedIncidentUrl', id: 'publishedIncidentUrl',
url: this.publishedIncidentUrl, url: this.publishedIncidentUrl,
text: STATUS_PAGE_PUBLISHED, text: STATUS_PAGE_PUBLISHED,
icon: 'tanuki', icon: 'tanuki',
}, });
{ }
if (this.zoomMeetingUrl) {
links.push({
id: 'zoomMeetingUrl', id: 'zoomMeetingUrl',
url: this.zoomMeetingUrl, url: this.zoomMeetingUrl,
text: JOIN_ZOOM_MEETING, text: JOIN_ZOOM_MEETING,
icon: 'brand-zoom', icon: 'brand-zoom',
}, });
]; }
return links;
}, },
}, },
methods: { methods: {
...@@ -45,7 +50,7 @@ export default { ...@@ -45,7 +50,7 @@ export default {
</script> </script>
<template> <template>
<div class="gl-display-flex gl-justify-content-start"> <div v-if="pinnedLinks && pinnedLinks.length" class="gl-display-flex gl-justify-content-start">
<template v-for="(link, i) in pinnedLinks"> <template v-for="(link, i) in pinnedLinks">
<div v-if="link.url" :key="link.id" :class="{ 'gl-pr-3': needsPaddingClass(i) }"> <div v-if="link.url" :key="link.id" :class="{ 'gl-pr-3': needsPaddingClass(i) }">
<gl-button <gl-button
......
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
-# haml-lint:disable InlineJavaScript -# haml-lint:disable InlineJavaScript
%script#js-issuable-app-initial-data{ type: "application/json" }= issuable_initial_data(@issue).to_json %script#js-issuable-app-initial-data{ type: "application/json" }= issuable_initial_data(@issue).to_json
#js-issuable-app #js-issuable-app
%h2.title= markdown_field(@issue, :title) .title-container
%h2.title= markdown_field(@issue, :title)
- if @issue.description.present? - if @issue.description.present?
.description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' } .description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' }
.md= markdown_field(@issue, :description) .md= markdown_field(@issue, :description)
......
...@@ -36,11 +36,26 @@ describe('Description component', () => { ...@@ -36,11 +36,26 @@ describe('Description component', () => {
$('.issuable-meta .flash-container').remove(); $('.issuable-meta .flash-container').remove();
}); });
it('animates description changes', () => { it('doesnt animate first description changes', () => {
vm.descriptionHtml = 'changed'; vm.descriptionHtml = 'changed';
return vm.$nextTick().then(() => {
expect(
vm.$el.querySelector('.md').classList.contains('issue-realtime-pre-pulse'),
).toBeFalsy();
jest.runAllTimers();
return vm.$nextTick();
});
});
it('animates description changes on live update', () => {
vm.descriptionHtml = 'changed';
return vm return vm
.$nextTick() .$nextTick()
.then(() => {
vm.descriptionHtml = 'changed second time';
return vm.$nextTick();
})
.then(() => { .then(() => {
expect( expect(
vm.$el.querySelector('.md').classList.contains('issue-realtime-pre-pulse'), vm.$el.querySelector('.md').classList.contains('issue-realtime-pre-pulse'),
......
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