LCOV - code coverage report
Current view: top level - src/components/SSVGPropList - PropertyEnumerated.vue.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 5 7 71.4 %
Date: 2025-06-29 02:18:36 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // @ts-check
       2             : 
       3             : import Vue from "vue";
       4             : import PropertyMixin from "./PropertyMixin";
       5             : import BadgeButton from "../BadgeButton.vue";
       6             : import { getAttribute } from "../../utils/element";
       7             : import { parser } from "@cern/ssvg-engine";
       8             : 
       9             : 
      10             : /**
      11             :  * @typedef {typeof import("@cern/base-vue").BaseSelect} BaseSelect
      12             :  * @typedef {{ value: V.Instance<BaseSelect> }} Refs
      13             :  */
      14             : 
      15             : export default /** @type {V.Constructor<any, Refs>} */ (Vue).extend({
      16             :   name: "PropertyEnumerated",
      17             :   components: { BadgeButton },
      18             :   mixins: [ PropertyMixin ],
      19             :   computed: {
      20             :     /** @return {string[]} */
      21             :     valueList() {
      22           4 :       try {
      23           4 :         return parser.parseList({ index: 0, value: getAttribute(this.property, "values") },
      24             :           parser.parseString);
      25             :       }
      26             :       catch {
      27           0 :         return [];
      28             :       }
      29             :     }
      30             :   },
      31             :   watch: {
      32           3 :     value() { this.$refs.value.editValue = this.value; }
      33             :   },
      34             :   mounted() {
      35           3 :     this.$refs.value.editValue = this.value;
      36             :   },
      37             :   methods: {
      38             :     onEdit() {
      39           6 :       if (!this.$refs.value.hasFocus) { return; }
      40           0 :       this.$store.commit("engine/updateState", { [this.name]: this.$refs?.value?.editValue });
      41             :     }
      42             :   }
      43             : });

Generated by: LCOV version 1.16