Commit 73d3cb8c authored by Phil Hughes's avatar Phil Hughes

Fixed image commenting on moved files

parent 9f5dfd59
......@@ -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({
......
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