All files / app/assets/javascripts/vue_shared/components/markdown suggestion_diff_row.vue

100% Statements 3/3
100% Branches 2/2
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45  101x                             13x     13x                                                  
<script>
import SafeHtml from '~/vue_shared/directives/safe_html';
 
export default {
  name: 'SuggestionDiffRow',
  directives: {
    SafeHtml,
  },
  props: {
    line: {
      type: Object,
      required: true,
    },
  },
  computed: {
    displayAsCell() {
      return !(this.line.rich_text || this.line.text);
    },
    lineType() {
      return this.line.type;
    },
  },
};
</script>
 
<template>
  <tr class="line_holder" :class="lineType">
    <td class="diff-line-num old_line border-top-0 border-bottom-0" :class="lineType">
      {{ line.old_line }}
    </td>
    <td class="diff-line-num new_line border-top-0 border-bottom-0" :class="lineType">
      {{ line.new_line }}
    </td>
    <td
      class="line_content"
      :class="[{ 'd-table-cell': displayAsCell }, lineType]"
      data-testid="suggestion-diff-content"
    >
      <span v-if="line.rich_text" v-safe-html="line.rich_text" class="line"></span>
      <span v-else-if="line.text" class="line">{{ line.text }}</span>
      <span v-else class="line"></span>
    </td>
  </tr>
</template>