Merge branch 'enable-image-comments-for-renamed-files' into 'master'
Fixed image commenting on moved files See merge request gitlab-org/gitlab-ce!23023
This commit is contained in:
commit
da521deb5f
2 changed files with 25 additions and 2 deletions
|
@ -44,8 +44,11 @@ export default {
|
|||
isNew() {
|
||||
return this.diffMode === diffModes.new;
|
||||
},
|
||||
isRenamed() {
|
||||
return this.diffMode === diffModes.renamed;
|
||||
},
|
||||
imagePath() {
|
||||
return this.isNew ? this.newPath : this.oldPath;
|
||||
return this.isNew || this.isRenamed ? this.newPath : this.oldPath;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
@ -114,7 +117,7 @@ export default {
|
|||
}]"
|
||||
>
|
||||
<slot
|
||||
v-if="isNew"
|
||||
v-if="isNew || isRenamed"
|
||||
slot="image-overlay"
|
||||
name="image-overlay"
|
||||
>
|
||||
|
|
|
@ -97,6 +97,26 @@ describe('ImageDiffViewer', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('renders image diff for renamed', done => {
|
||||
vm = new Vue({
|
||||
components: {
|
||||
imageDiffViewer,
|
||||
},
|
||||
template: `
|
||||
<image-diff-viewer diff-mode="renamed" new-path="${GREEN_BOX_IMAGE_URL}" old-path="">
|
||||
<span slot="image-overlay" class="overlay">test</span>
|
||||
</image-diff-viewer>
|
||||
`,
|
||||
}).$mount();
|
||||
|
||||
setTimeout(() => {
|
||||
expect(vm.$el.querySelector('img').getAttribute('src')).toBe(GREEN_BOX_IMAGE_URL);
|
||||
expect(vm.$el.querySelector('.overlay')).not.toBe(null);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('swipeMode', () => {
|
||||
beforeEach(done => {
|
||||
createComponent({
|
||||
|
|
Loading…
Reference in a new issue