All files / src/features/targets/components/target-form BrowserSection.vue

62.5% Statements 5/8
0% Branches 0/6
0% Functions 0/1
62.5% Lines 5/8

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 46 47 48 49 50 51 52 53                                                            4x 4x 4x 4x 4x                                    
<template>
  <Accordion
    class="form-accordion margin-bottom-s"
    :active-index="accordionIndex"
  >
    <AccordionTab header="BROWSER CHARACTERISTICS">
      <div class="form-field margin-bottom-xs">
        <label class="form-label">Previous Location</label>
        <InputText
          :model-value="formData.previousLocation"
          name="previousLocation"
          label="https://example.com/previous-page"
          type="url"
          @update:model-value="
            $emit('update:field', 'previousLocation', $event)
          "
        />
        <div
          v-if="validationErrors.previousLocation"
          class="form-error is-visible"
        >
          <Icon :icon="csgErrorRed" />
          <span>{{ validationErrors.previousLocation }}</span>
        </div>
      </div>
    </AccordionTab>
  </Accordion>
</template>
 
<script setup>
import { Accordion, AccordionTab } from '@atomic-ui/accordion';
import Icon from '@atomic-ui/icon';
import InputText from '@atomic-ui/inputText';
import { csgErrorRed } from '@csgSvgIcons/icons';
import { computed } from 'vue';
 
const props = defineProps({
  formData: { type: Object, required: true },
  validationErrors: { type: Object, required: true },
});
 
defineEmits(['update:field']);
 
const accordionIndex = computed(() => {
  const hasValues = props.formData.previousLocation?.trim();
  return hasValues ? 0 : null;
});
</script>
 
<style scoped lang="scss">
@import './_target-form-styles.scss';
</style>