11<script setup>
2- import { ref , computed , onMounted , onBeforeUnmount } from " vue" ;
2+ import { ref , computed , onMounted } from " vue" ;
33import { treeShake , palette , rotateMatrix , addVector , matrixTimes , opacity , convertColorToHex , convertConfigColors } from " ../lib.js" ;
44import pdf from " ../pdf" ;
55import mainConfig from " ../default_configs.json" ;
@@ -265,27 +265,27 @@ defineExpose({
265265 >
266266 <!-- TITLE AS DIV -->
267267 <div v-if =" (!mutableConfig.inside || isPrinting) && gaugeConfig.style.chart.title.text" :style =" `width:100%;background:${gaugeConfig.style.chart.backgroundColor};padding-bottom:12px;${gaugeConfig.userOptions.show ? 'padding-top:36px' : ''}`" >
268- <div :style =" `width:100%;text-align:center;color:${gaugeConfig.style.chart.title.color};font-size:${gaugeConfig.style.chart.title.fontSize}px;font-weight:${gaugeConfig.style.chart.title.bold ? 'bold': ''}`" >
268+ <div data-cy = " gauge-div-title " :style =" `width:100%;text-align:center;color:${gaugeConfig.style.chart.title.color};font-size:${gaugeConfig.style.chart.title.fontSize}px;font-weight:${gaugeConfig.style.chart.title.bold ? 'bold': ''}`" >
269269 {{ gaugeConfig.style.chart.title.text }}
270270 </div >
271- <div v-if =" gaugeConfig.style.chart.title.subtitle.text" :style =" `width:100%;text-align:center;color:${gaugeConfig.style.chart.title.subtitle.color};font-size:${gaugeConfig.style.chart.title.subtitle.fontSize}px;font-weight:${gaugeConfig.style.chart.title.subtitle.bold ? 'bold': ''}`" >
271+ <div data-cy = " gauge-div-subtitle " v-if =" gaugeConfig.style.chart.title.subtitle.text" :style =" `width:100%;text-align:center;color:${gaugeConfig.style.chart.title.subtitle.color};font-size:${gaugeConfig.style.chart.title.subtitle.fontSize}px;font-weight:${gaugeConfig.style.chart.title.subtitle.bold ? 'bold': ''}`" >
272272 {{ gaugeConfig.style.chart.title.subtitle.text }}
273273 </div >
274- <div v-if =" !isNaN(dataset.base)" :style =" `width:100%;text-align:center;color:${gaugeConfig.style.chart.title.subtitle.color};font-size:${gaugeConfig.style.chart.title.subtitle.fontSize}px;font-weight:${gaugeConfig.style.chart.title.subtitle.bold ? 'bold': ''}`" >
274+ <div data-cy = " gauge-div-base " v-if =" !isNaN(dataset.base)" :style =" `width:100%;text-align:center;color:${gaugeConfig.style.chart.title.subtitle.color};font-size:${gaugeConfig.style.chart.title.subtitle.fontSize}px;font-weight:${gaugeConfig.style.chart.title.subtitle.bold ? 'bold': ''}`" >
275275 {{ gaugeConfig.translations.base }} : {{ dataset.base }}
276276 </div >
277277 </div >
278278
279279 <!-- OPTIONS -->
280280 <details class =" vue-ui-gauge-user-options" :style =" `background:${gaugeConfig.style.chart.backgroundColor};color:${gaugeConfig.style.chart.color}`" data-html2canvas-ignore v-if =" gaugeConfig.userOptions.show" ref =" details" >
281- <summary :style =" `background:${gaugeConfig.style.chart.backgroundColor};color:${gaugeConfig.style.chart.color}`" >{{ gaugeConfig.userOptions.title }}</summary >
281+ <summary data-cy = " gauge-summary " :style =" `background:${gaugeConfig.style.chart.backgroundColor};color:${gaugeConfig.style.chart.color}`" >{{ gaugeConfig.userOptions.title }}</summary >
282282 <div class =" vue-ui-gauge-user-options-items" :style =" `background:${gaugeConfig.style.chart.backgroundColor};color:${gaugeConfig.style.chart.color}`" >
283283 <div class =" vue-ui-gauge-user-option-item" >
284- <input type =" checkbox" :id =" `vue-ui-gauge-option-title_${uid}`" :name =" `vue-ui-gauge-option-title_${uid}`"
284+ <input data-cy = " gauge-checkbox-title " type =" checkbox" :id =" `vue-ui-gauge-option-title_${uid}`" :name =" `vue-ui-gauge-option-title_${uid}`"
285285 v-model =" mutableConfig.inside" >
286286 <label :for =" `vue-ui-gauge-option-title_${uid}`" >{{ gaugeConfig.userOptions.labels.useDiv }}</label >
287287 </div >
288- <button class =" vue-ui-gauge-button" @click =" generatePdf" :disabled =" isPrinting" style =" margin-top :12px " :style =" `color:${gaugeConfig.style.chart.color}`" >
288+ <button data-cy = " gauge-pdf " class =" vue-ui-gauge-button" @click =" generatePdf" :disabled =" isPrinting" style =" margin-top :12px " :style =" `color:${gaugeConfig.style.chart.color}`" >
289289 <svg class =" vue-ui-gauge-print-icon" xmlns =" http://www.w3.org/2000/svg" v-if =" isPrinting" width =" 20" height =" 20" viewBox =" 0 0 24 24" stroke-width =" 1.5" :stroke =" gaugeConfig.style.chart.color" fill =" none" stroke-linecap =" round" stroke-linejoin =" round" >
290290 <path stroke =" none" d =" M0 0h24v24H0z" fill =" none" />
291291 <path d =" M18 16v.01" />
@@ -313,6 +313,7 @@ defineExpose({
313313 <!-- TITLE AS G -->
314314 <g v-if =" gaugeConfig.style.chart.title.text && mutableConfig.inside && !isPrinting" >
315315 <text
316+ data-cy =" gauge-text-title"
316317 :font-size =" (gaugeConfig.style.chart.title.fontSize * 1.5)"
317318 :fill =" gaugeConfig.style.chart.title.color"
318319 :x =" svg.width / 2"
@@ -323,6 +324,7 @@ defineExpose({
323324 {{ gaugeConfig.style.chart.title.text }}
324325 </text >
325326 <text
327+ data-cy =" gauge-text-subtitle"
326328 v-if =" gaugeConfig.style.chart.title.subtitle.text"
327329 :font-size =" (gaugeConfig.style.chart.title.subtitle.fontSize * 1.5)"
328330 :fill =" gaugeConfig.style.chart.title.subtitle.color"
@@ -334,6 +336,7 @@ defineExpose({
334336 {{ gaugeConfig.style.chart.title.subtitle.text }}
335337 </text >
336338 <text
339+ data-cy =" gauge-text-base"
337340 v-if =" !isNaN(dataset.base)"
338341 :font-size =" (gaugeConfig.style.chart.title.subtitle.fontSize * 1.5)"
339342 :fill =" gaugeConfig.style.chart.title.subtitle.color"
@@ -349,6 +352,7 @@ defineExpose({
349352 <!-- ARC STEPS -->
350353 <path
351354 v-for =" (arc, i) in makeDonut(mutableDataset, svg.width / 2, svg.height * 0.7, svg.width / 2.5, svg.width / 2.5)"
355+ :data-cy =" `gauge-arc-${i}`"
352356 :key =" `arc_${i}`"
353357 :d =" arc.path"
354358 fill =" none"
@@ -367,6 +371,7 @@ defineExpose({
367371 <!-- STEP MARKERS -->
368372 <circle
369373 v-for =" (arc, i) in makeDonut(mutableDataset, svg.width / 2, svg.height * 0.7, svg.width / 2.5, svg.width / 2.5)"
374+ :data-cy =" `gauge-step-marker-${i}`"
370375 :cx =" arc.center.startX"
371376 :cy =" i === 0 ? arc.center.startY + 5 : arc.center.startY"
372377 :r =" (svg.width / 31) * gaugeConfig.style.chart.layout.track.size * gaugeConfig.style.chart.layout.markers.size"
@@ -375,6 +380,7 @@ defineExpose({
375380 :stroke-width =" gaugeConfig.style.chart.layout.markers.strokeWidth"
376381 />
377382 <circle
383+ data-cy =" gauge-step-marker-last"
378384 :cx =" svg.width * 0.9"
379385 :cy =" svg.height * 0.69"
380386 :r =" (svg.width / 31) * gaugeConfig.style.chart.layout.track.size * gaugeConfig.style.chart.layout.markers.size"
@@ -384,6 +390,7 @@ defineExpose({
384390 />
385391 <text
386392 v-for =" (arc, i) in makeDonut(mutableDataset, svg.width / 2, svg.height * 0.7, svg.width / 2.5, svg.width / 2.5)"
393+ :data-cy =" `gauge-step-marker-label-${i}`"
387394 :x =" arc.center.startX"
388395 :y =" calcMarkerPositionY(i, arc.center.startY, arc.from) + gaugeConfig.style.chart.layout.markers.offsetY"
389396 text-anchor =" middle"
@@ -394,6 +401,7 @@ defineExpose({
394401 {{ arc.from.toFixed(gaugeConfig.style.chart.layout.markers.roundingValue) }}
395402 </text >
396403 <text
404+ data-cy =" gauge-step-marker-label-last"
397405 :x =" svg.width * 0.9"
398406 :y =" calcMarkerPositionY(1, svg.height * 0.69, max) + gaugeConfig.style.chart.layout.markers.offsetY"
399407 text-anchor =" middle"
@@ -406,6 +414,7 @@ defineExpose({
406414
407415 <!-- GAUGE POINTER -->
408416 <line
417+ data-cy =" gauge-pointer-border"
409418 v-if =" !isNaN(pointer.x2)"
410419 :x1 =" pointer.x1"
411420 :y1 =" pointer.y1"
@@ -416,6 +425,7 @@ defineExpose({
416425 stroke-linecap =" round"
417426 />
418427 <line
428+ data-cy =" gauge-pointer"
419429 v-if =" !isNaN(pointer.x2)"
420430 :x1 =" pointer.x1"
421431 :y1 =" pointer.y1"
@@ -426,6 +436,7 @@ defineExpose({
426436 :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.7"
427437 />
428438 <circle
439+ data-cy =" gauge-pointer-circle"
429440 :cx =" svg.width / 2"
430441 :cy =" (svg.height) * 0.69"
431442 :fill =" gaugeConfig.style.chart.layout.pointer.circle.color"
@@ -436,6 +447,7 @@ defineExpose({
436447
437448 <!-- GAUGE RATING -->
438449 <text
450+ data-cy =" gauge-score"
439451 :x =" svg.width / 2"
440452 :y =" (svg.height) * 0.9"
441453 text-anchor =" middle"
0 commit comments