@code-coaching/vuetiful 0.23.1 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/types/components/VBootstrap.vue.d.ts +1 -1
  3. package/dist/types/components/atoms/VAvatar.vue.d.ts +1 -1
  4. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +2 -2
  5. package/dist/types/components/atoms/index.d.ts +13 -13
  6. package/dist/types/components/index.d.ts +2 -2
  7. package/dist/types/components/molecules/VAlert.vue.d.ts +1 -1
  8. package/dist/types/components/molecules/VCodeBlock.vue.d.ts +2 -2
  9. package/dist/types/components/molecules/VDrawer.vue.d.ts +1 -1
  10. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +1 -1
  11. package/dist/types/components/molecules/VRail/VRail.vue.d.ts +1 -1
  12. package/dist/types/components/molecules/VRail/VRailTile.vue.d.ts +1 -1
  13. package/dist/types/components/molecules/index.d.ts +21 -21
  14. package/dist/types/directives/clipboard.d.ts +1 -1
  15. package/dist/types/directives/index.d.ts +1 -1
  16. package/dist/types/index.d.ts +6 -6
  17. package/dist/types/props/props.d.ts +1 -1
  18. package/dist/types/services/dark-mode.service.d.ts +1 -1
  19. package/dist/types/services/drawer.service.d.ts +1 -1
  20. package/dist/types/services/index.d.ts +5 -5
  21. package/dist/types/types/index.d.ts +1 -1
  22. package/dist/types/utils/index.d.ts +2 -2
  23. package/dist/types/utils/theme/theme-switcher.vue.d.ts +1 -1
  24. package/dist/types/utils/theme/theme.service.d.ts +1 -1
  25. package/dist/vuetiful.es.mjs +12 -18
  26. package/dist/vuetiful.umd.js +3 -3
  27. package/package.json +1 -1
  28. package/src/assets/main.css +6 -6
  29. package/src/components/VBootstrap.vue +43 -43
  30. package/src/components/atoms/VAvatar.test.ts +71 -71
  31. package/src/components/atoms/VAvatar.vue +22 -23
  32. package/src/components/atoms/VBadge.test.ts +11 -11
  33. package/src/components/atoms/VBadge.vue +2 -2
  34. package/src/components/atoms/VButton.test.ts +82 -82
  35. package/src/components/atoms/VButton.vue +20 -21
  36. package/src/components/atoms/VChip.test.ts +11 -11
  37. package/src/components/atoms/VChip.vue +3 -3
  38. package/src/components/atoms/VLightSwitch.test.ts +6 -6
  39. package/src/components/atoms/VLightSwitch.vue +26 -31
  40. package/src/components/atoms/VRadio/VRadioDescription.test.ts +13 -13
  41. package/src/components/atoms/VRadio/VRadioDescription.vue +2 -2
  42. package/src/components/atoms/VRadio/VRadioGroup.test.ts +40 -40
  43. package/src/components/atoms/VRadio/VRadioGroup.vue +19 -22
  44. package/src/components/atoms/VRadio/VRadioItem.test.ts +67 -67
  45. package/src/components/atoms/VRadio/VRadioItem.vue +10 -13
  46. package/src/components/atoms/VRadio/VRadioLabel.test.ts +13 -13
  47. package/src/components/atoms/VRadio/VRadioLabel.vue +5 -3
  48. package/src/components/atoms/VSwitch/VSwitch.test.ts +33 -33
  49. package/src/components/atoms/VSwitch/VSwitch.vue +24 -27
  50. package/src/components/atoms/VSwitch/VSwitchDescription.test.ts +13 -13
  51. package/src/components/atoms/VSwitch/VSwitchDescription.vue +2 -2
  52. package/src/components/atoms/VSwitch/VSwitchGroup.test.ts +9 -9
  53. package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
  54. package/src/components/atoms/VSwitch/VSwitchLabel.test.ts +19 -19
  55. package/src/components/atoms/VSwitch/VSwitchLabel.vue +2 -2
  56. package/src/components/atoms/index.ts +13 -13
  57. package/src/components/index.test.ts +3 -3
  58. package/src/components/index.ts +2 -2
  59. package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -17
  60. package/src/components/molecules/VAccordion/VAccordion.vue +3 -3
  61. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +55 -55
  62. package/src/components/molecules/VAccordion/VAccordionItem.vue +9 -22
  63. package/src/components/molecules/VAlert.test.ts +38 -38
  64. package/src/components/molecules/VAlert.vue +25 -47
  65. package/src/components/molecules/VCard/VCard.test.ts +25 -25
  66. package/src/components/molecules/VCard/VCard.vue +13 -15
  67. package/src/components/molecules/VCard/VCardBody.test.ts +14 -14
  68. package/src/components/molecules/VCard/VCardBody.vue +4 -8
  69. package/src/components/molecules/VCard/VCardFooter.test.ts +22 -22
  70. package/src/components/molecules/VCard/VCardFooter.vue +10 -8
  71. package/src/components/molecules/VCard/VCardHeader.test.ts +25 -25
  72. package/src/components/molecules/VCard/VCardHeader.vue +7 -8
  73. package/src/components/molecules/VCodeBlock.test.ts +63 -63
  74. package/src/components/molecules/VCodeBlock.vue +27 -34
  75. package/src/components/molecules/VDrawer.test.ts +5 -5
  76. package/src/components/molecules/VDrawer.vue +10 -10
  77. package/src/components/molecules/VListbox/VListbox.test.ts +53 -53
  78. package/src/components/molecules/VListbox/VListbox.vue +31 -32
  79. package/src/components/molecules/VListbox/VListboxButton.test.ts +13 -13
  80. package/src/components/molecules/VListbox/VListboxButton.vue +5 -5
  81. package/src/components/molecules/VListbox/VListboxItem.test.ts +25 -25
  82. package/src/components/molecules/VListbox/VListboxItem.vue +7 -8
  83. package/src/components/molecules/VListbox/VListboxItems.test.ts +14 -14
  84. package/src/components/molecules/VListbox/VListboxItems.vue +9 -11
  85. package/src/components/molecules/VListbox/VListboxLabel.test.ts +10 -10
  86. package/src/components/molecules/VListbox/VListboxLabel.vue +2 -2
  87. package/src/components/molecules/VPreview.test.ts +26 -26
  88. package/src/components/molecules/VPreview.vue +22 -27
  89. package/src/components/molecules/VRail/VRail.test.ts +5 -5
  90. package/src/components/molecules/VRail/VRail.vue +7 -7
  91. package/src/components/molecules/VRail/VRailTile.test.ts +26 -28
  92. package/src/components/molecules/VRail/VRailTile.vue +13 -11
  93. package/src/components/molecules/VShell.test.ts +5 -5
  94. package/src/components/molecules/VShell.vue +11 -20
  95. package/src/components/molecules/VTabs/VTab.test.ts +48 -52
  96. package/src/components/molecules/VTabs/VTab.vue +13 -17
  97. package/src/components/molecules/VTabs/VTabPanel.test.ts +8 -8
  98. package/src/components/molecules/VTabs/VTabPanel.vue +1 -1
  99. package/src/components/molecules/VTabs/VTabs.test.ts +36 -36
  100. package/src/components/molecules/VTabs/VTabs.vue +18 -22
  101. package/src/components/molecules/index.ts +21 -21
  102. package/src/directives/clipboard.test.ts +9 -9
  103. package/src/directives/clipboard.ts +2 -2
  104. package/src/directives/index.ts +1 -1
  105. package/src/env.d.ts +2 -2
  106. package/src/index.test.ts +6 -6
  107. package/src/index.ts +7 -7
  108. package/src/props/index.ts +1 -1
  109. package/src/props/props.ts +44 -44
  110. package/src/services/dark-mode.service.test.ts +115 -93
  111. package/src/services/dark-mode.service.ts +9 -9
  112. package/src/services/drawer.service.test.ts +21 -21
  113. package/src/services/drawer.service.ts +10 -10
  114. package/src/services/highlight.service.test.ts +12 -12
  115. package/src/services/highlight.service.ts +1 -1
  116. package/src/services/index.ts +5 -5
  117. package/src/services/rail.service.test.ts +7 -7
  118. package/src/services/rail.service.ts +2 -2
  119. package/src/services/settings.service.test.ts +5 -5
  120. package/src/services/settings.service.ts +1 -1
  121. package/src/styles/all.css +7 -7
  122. package/src/styles/elements/buttons.css +1 -1
  123. package/src/styles/elements/forms.css +7 -7
  124. package/src/styles/elements.css +13 -13
  125. package/src/styles/transitions.css +2 -2
  126. package/src/styles/typography.css +5 -5
  127. package/src/themes/theme-rocket.css +10 -10
  128. package/src/themes/theme-sahara.css +13 -13
  129. package/src/themes/theme-seafoam.css +13 -13
  130. package/src/themes/theme-seasonal.css +4 -4
  131. package/src/themes/theme-skeleton.css +7 -7
  132. package/src/themes/theme-vintage.css +12 -12
  133. package/src/themes/theme-vuetiful-0.0.1.css +13 -13
  134. package/src/types/index.ts +46 -46
  135. package/src/types/tailwind.ts +2 -21
  136. package/src/utils/index.test.ts +3 -3
  137. package/src/utils/index.ts +2 -2
  138. package/src/utils/platform/platform.service.test.ts +6 -6
  139. package/src/utils/platform/platform.service.ts +1 -1
  140. package/src/utils/theme/callback.test.ts +6 -6
  141. package/src/utils/theme/remove.test.ts +8 -8
  142. package/src/utils/theme/theme-switcher.vue +10 -13
  143. package/src/utils/theme/theme.service.test.ts +69 -61
  144. package/src/utils/theme/theme.service.ts +19 -20
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { useSettings } from "@/index";
3
- import { unstyledProp } from "@/props";
4
- import { provide } from "vue";
2
+ import { useSettings } from '@/index';
3
+ import { unstyledProp } from '@/props';
4
+ import { provide } from 'vue';
5
5
 
6
- const emit = defineEmits(["click"]);
6
+ const emit = defineEmits(['click']);
7
7
 
8
8
  const props = defineProps({
9
9
  hideSeparator: {
@@ -12,11 +12,11 @@ const props = defineProps({
12
12
  },
13
13
  background: {
14
14
  type: String,
15
- default: "bg-surface-200-700-token",
15
+ default: 'bg-surface-200-700-token',
16
16
  },
17
17
  text: {
18
18
  type: String,
19
- default: "text-surface-900-50-token",
19
+ default: 'text-surface-900-50-token',
20
20
  },
21
21
  clickable: {
22
22
  type: Boolean,
@@ -26,21 +26,21 @@ const props = defineProps({
26
26
  unstyled: unstyledProp,
27
27
  });
28
28
 
29
- provide("hideSeparator", props.hideSeparator);
29
+ provide('hideSeparator', props.hideSeparator);
30
30
 
31
31
  const onClick = () => {
32
32
  if (!props.clickable) return;
33
- emit("click");
33
+ emit('click');
34
34
  };
35
35
  const onKeydown = (event: KeyboardEvent) => {
36
36
  if (!props.clickable) return;
37
- if (event.key === "Enter") {
37
+ if (event.key === 'Enter') {
38
38
  event.preventDefault();
39
- emit("click");
39
+ emit('click');
40
40
  }
41
- if (event.key === " ") {
41
+ if (event.key === ' ') {
42
42
  event.preventDefault();
43
- emit("click");
43
+ emit('click');
44
44
  }
45
45
  };
46
46
 
@@ -55,9 +55,7 @@ const isUnstyled = settings.global.unstyled || settings.components.card.unstyled
55
55
  :tabindex="clickable ? 0 : undefined"
56
56
  :class="`vuetiful-card flex flex-col ${
57
57
  isUnstyled ? '' : 'border-token rounded-container-token ring-outline-token'
58
- } ${background} ${text} ${
59
- clickable ? `${isUnstyled ? '' : 'card-hover'} hover:cursor-pointer` : ''
60
- }`"
58
+ } ${background} ${text} ${clickable ? `${isUnstyled ? '' : 'card-hover'} hover:cursor-pointer` : ''}`"
61
59
  >
62
60
  <slot />
63
61
  </div>
@@ -1,9 +1,9 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VCard, VCardBody } from "..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VCard, VCardBody } from '..';
4
4
 
5
- describe("VCardBody", () => {
6
- test("unstyled", () => {
5
+ describe('VCardBody', () => {
6
+ test('unstyled', () => {
7
7
  const wrapper = mount({
8
8
  template: /*html*/ `
9
9
  <v-card>
@@ -11,17 +11,17 @@ describe("VCardBody", () => {
11
11
  </v-card>
12
12
  `,
13
13
  components: {
14
- "v-card": VCard,
15
- "v-card-body": VCardBody,
14
+ 'v-card': VCard,
15
+ 'v-card-body': VCardBody,
16
16
  },
17
17
  });
18
18
 
19
19
  const content = wrapper.find("[data-test='vuetiful-card-body-content']");
20
- expect(content.text()).toEqual("John Duck");
21
- expect(content.classes()).not.toContain("p-4");
20
+ expect(content.text()).toEqual('John Duck');
21
+ expect(content.classes()).not.toContain('p-4');
22
22
  });
23
23
 
24
- test("defaults", async () => {
24
+ test('defaults', async () => {
25
25
  const wrapper = mount({
26
26
  template: /*html*/ `
27
27
  <v-card>
@@ -29,11 +29,11 @@ describe("VCardBody", () => {
29
29
  </v-card>
30
30
  `,
31
31
  components: {
32
- "v-card": VCard,
33
- "v-card-body": VCardBody,
32
+ 'v-card': VCard,
33
+ 'v-card-body': VCardBody,
34
34
  },
35
35
  });
36
36
 
37
- expect(wrapper.text()).toEqual("John Duck");
37
+ expect(wrapper.text()).toEqual('John Duck');
38
38
  });
39
- });
39
+ });
@@ -1,20 +1,16 @@
1
1
  <script setup lang="ts">
2
- import { unstyledProp } from "@/props";
3
- import { useSettings } from "@/services";
2
+ import { unstyledProp } from '@/props';
3
+ import { useSettings } from '@/services';
4
4
 
5
5
  const props = defineProps({
6
6
  unstyled: unstyledProp,
7
7
  });
8
8
 
9
9
  const { settings } = useSettings();
10
- const isUnstyled =
11
- settings.global.unstyled || settings.components.cardBody.unstyled || props.unstyled;
10
+ const isUnstyled = settings.global.unstyled || settings.components.cardBody.unstyled || props.unstyled;
12
11
  </script>
13
12
  <template>
14
- <div
15
- data-test="vuetiful-card-body-content"
16
- :class="`vuetiful-card-body ${isUnstyled ? '' : 'p-4'}`"
17
- >
13
+ <div data-test="vuetiful-card-body-content" :class="`vuetiful-card-body ${isUnstyled ? '' : 'p-4'}`">
18
14
  <slot />
19
15
  </div>
20
16
  </template>
@@ -1,9 +1,9 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VCard, VCardFooter } from "..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VCard, VCardFooter } from '..';
4
4
 
5
- describe("VCardFooter", () => {
6
- test("unstyled", () => {
5
+ describe('VCardFooter', () => {
6
+ test('unstyled', () => {
7
7
  const wrapper = mount({
8
8
  template: /*html*/ `
9
9
  <v-card>
@@ -11,17 +11,17 @@ describe("VCardFooter", () => {
11
11
  </v-card>
12
12
  `,
13
13
  components: {
14
- "v-card": VCard,
15
- "v-card-footer": VCardFooter,
14
+ 'v-card': VCard,
15
+ 'v-card-footer': VCardFooter,
16
16
  },
17
17
  });
18
18
 
19
19
  const content = wrapper.find("[data-test='vuetiful-card-footer-content']");
20
- expect(content.text()).toEqual("John Duck");
21
- expect(content.classes()).not.toContain("p-4");
20
+ expect(content.text()).toEqual('John Duck');
21
+ expect(content.classes()).not.toContain('p-4');
22
22
  });
23
23
 
24
- test("defaults", async () => {
24
+ test('defaults', async () => {
25
25
  const wrapper = mount({
26
26
  template: /*html*/ `
27
27
  <v-card>
@@ -29,19 +29,19 @@ describe("VCardFooter", () => {
29
29
  </v-card>
30
30
  `,
31
31
  components: {
32
- "v-card": VCard,
33
- "v-card-footer": VCardFooter,
32
+ 'v-card': VCard,
33
+ 'v-card-footer': VCardFooter,
34
34
  },
35
35
  });
36
36
 
37
37
  const separator = wrapper.find("[data-test='vuetiful-card-footer-separator']");
38
38
  const content = wrapper.find("[data-test='vuetiful-card-footer-content']");
39
- expect(separator.element.tagName).toEqual("HR");
40
- expect(content.text()).toEqual("John Duck");
39
+ expect(separator.element.tagName).toEqual('HR');
40
+ expect(content.text()).toEqual('John Duck');
41
41
  });
42
42
 
43
- describe("given hideSeparator is true", () => {
44
- test("should not show separator", async () => {
43
+ describe('given hideSeparator is true', () => {
44
+ test('should not show separator', async () => {
45
45
  const wrapper = mount({
46
46
  template: /*html*/ `
47
47
  <v-card hide-separator>
@@ -49,15 +49,15 @@ describe("VCardFooter", () => {
49
49
  </v-card>
50
50
  `,
51
51
  components: {
52
- "v-card": VCard,
53
- "v-card-footer": VCardFooter,
52
+ 'v-card': VCard,
53
+ 'v-card-footer': VCardFooter,
54
54
  },
55
55
  });
56
-
56
+
57
57
  const separator = wrapper.find("[data-test='vuetiful-card-footer-separator']");
58
58
  const content = wrapper.find("[data-test='vuetiful-card-footer-content']");
59
59
  expect(separator.exists()).toEqual(false);
60
- expect(content.text()).toEqual("John Duck");
61
- })
62
- })
60
+ expect(content.text()).toEqual('John Duck');
61
+ });
62
+ });
63
63
  });
@@ -1,29 +1,31 @@
1
1
  <script setup lang="ts">
2
- import { inject, useAttrs } from "vue";
3
- import { unstyledProp } from "@/props";
4
- import { useSettings } from "@/services";
2
+ import { inject, useAttrs } from 'vue';
3
+ import { unstyledProp } from '@/props';
4
+ import { useSettings } from '@/services';
5
5
 
6
6
  const props = defineProps({
7
7
  classSeparator: {
8
8
  type: String as () => string,
9
- default: "opacity-90",
9
+ default: 'opacity-90',
10
10
  },
11
11
  unstyled: unstyledProp,
12
12
  });
13
13
 
14
- const hideSeparator = inject("hideSeparator", false);
14
+ const hideSeparator = inject('hideSeparator', false);
15
15
 
16
16
  const attrs = useAttrs();
17
17
  const classAttribute = attrs.class as string;
18
18
 
19
19
  const { settings } = useSettings();
20
- const isUnstyled =
21
- settings.global.unstyled || settings.components.cardBody.unstyled || props.unstyled;
20
+ const isUnstyled = settings.global.unstyled || settings.components.cardBody.unstyled || props.unstyled;
22
21
  </script>
23
22
 
24
23
  <template>
25
24
  <hr v-if="!hideSeparator" data-test="vuetiful-card-footer-separator" class="divider" :class="classSeparator" />
26
- <div data-test="vuetiful-card-footer-content" :class="`vuetiful-card-footer ${isUnstyled ? '' : 'p-4'} ${classAttribute}`">
25
+ <div
26
+ data-test="vuetiful-card-footer-content"
27
+ :class="`vuetiful-card-footer ${isUnstyled ? '' : 'p-4'} ${classAttribute}`"
28
+ >
27
29
  <slot />
28
30
  </div>
29
31
  </template>
@@ -1,9 +1,9 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test } from "vitest";
3
- import { VCard, VCardHeader } from "..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test } from 'vitest';
3
+ import { VCard, VCardHeader } from '..';
4
4
 
5
- describe("VCardHeader", () => {
6
- test("unstyled", () => {
5
+ describe('VCardHeader', () => {
6
+ test('unstyled', () => {
7
7
  const wrapper = mount({
8
8
  template: /*html*/ `
9
9
  <v-card>
@@ -11,17 +11,17 @@ describe("VCardHeader", () => {
11
11
  </v-card>
12
12
  `,
13
13
  components: {
14
- "v-card": VCard,
15
- "v-card-header": VCardHeader,
14
+ 'v-card': VCard,
15
+ 'v-card-header': VCardHeader,
16
16
  },
17
17
  });
18
18
 
19
19
  const content = wrapper.find("[data-test='vuetiful-card-header-content']");
20
- expect(content.text()).toEqual("John Duck");
21
- expect(content.classes()).not.toContain("p-4");
20
+ expect(content.text()).toEqual('John Duck');
21
+ expect(content.classes()).not.toContain('p-4');
22
22
  });
23
23
 
24
- test("defaults", async () => {
24
+ test('defaults', async () => {
25
25
  const wrapper = mount({
26
26
  template: /*html*/ `
27
27
  <v-card>
@@ -29,20 +29,20 @@ describe("VCardHeader", () => {
29
29
  </v-card>
30
30
  `,
31
31
  components: {
32
- "v-card": VCard,
33
- "v-card-header": VCardHeader,
32
+ 'v-card': VCard,
33
+ 'v-card-header': VCardHeader,
34
34
  },
35
35
  });
36
36
 
37
37
  const separator = wrapper.find("[data-test='vuetiful-card-header-separator']");
38
38
  const content = wrapper.find("[data-test='vuetiful-card-header-content']");
39
- expect(separator.element.tagName).toEqual("HR");
40
- expect(content.text()).toEqual("John Duck");
41
- expect(content.classes()).toContain("p-4");
39
+ expect(separator.element.tagName).toEqual('HR');
40
+ expect(content.text()).toEqual('John Duck');
41
+ expect(content.classes()).toContain('p-4');
42
42
  });
43
43
 
44
- describe("given hideSeparator is true", () => {
45
- test("should not show separator", async () => {
44
+ describe('given hideSeparator is true', () => {
45
+ test('should not show separator', async () => {
46
46
  const wrapper = mount({
47
47
  template: /*html*/ `
48
48
  <v-card hide-separator>
@@ -50,20 +50,20 @@ describe("VCardHeader", () => {
50
50
  </v-card>
51
51
  `,
52
52
  components: {
53
- "v-card": VCard,
54
- "v-card-header": VCardHeader,
53
+ 'v-card': VCard,
54
+ 'v-card-header': VCardHeader,
55
55
  },
56
56
  });
57
57
 
58
58
  const separator = wrapper.find("[data-test='vuetiful-card-header-separator']");
59
59
  const content = wrapper.find("[data-test='vuetiful-card-header-content']");
60
60
  expect(separator.exists()).toEqual(false);
61
- expect(content.text()).toEqual("John Duck");
61
+ expect(content.text()).toEqual('John Duck');
62
62
  });
63
63
  });
64
64
 
65
- describe("given an image is present", () => {
66
- test("should not have padding", async () => {
65
+ describe('given an image is present', () => {
66
+ test('should not have padding', async () => {
67
67
  const wrapper = mount({
68
68
  template: /*html*/ `
69
69
  <v-card>
@@ -73,14 +73,14 @@ describe("VCardHeader", () => {
73
73
  </v-card>
74
74
  `,
75
75
  components: {
76
- "v-card": VCard,
77
- "v-card-header": VCardHeader,
76
+ 'v-card': VCard,
77
+ 'v-card-header': VCardHeader,
78
78
  },
79
79
  });
80
80
  await wrapper.vm.$nextTick();
81
81
 
82
82
  const content = wrapper.find("[data-test='vuetiful-card-header-content']");
83
- expect(content.classes()).not.toContain("p-4");
83
+ expect(content.classes()).not.toContain('p-4');
84
84
  });
85
85
  });
86
86
  });
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { unstyledProp } from "@/props";
3
- import { useSettings } from "@/services";
4
- import { Ref, computed, inject, ref, useAttrs } from "vue";
2
+ import { unstyledProp } from '@/props';
3
+ import { useSettings } from '@/services';
4
+ import { Ref, computed, inject, ref, useAttrs } from 'vue';
5
5
 
6
6
  const props = defineProps({
7
7
  classSeparator: {
8
8
  type: String as () => string,
9
- default: "opacity-90",
9
+ default: 'opacity-90',
10
10
  },
11
11
  unstyled: unstyledProp,
12
12
  });
@@ -17,17 +17,16 @@ const hasImageAsChild = computed(() => {
17
17
  const children = headerRef.value?.children;
18
18
  if (!children) return false;
19
19
  const childrenArray = Array.from(children);
20
- return childrenArray.some((child) => child.tagName === "IMG");
20
+ return childrenArray.some((child) => child.tagName === 'IMG');
21
21
  });
22
22
 
23
- const hideSeparator = inject("hideSeparator", false);
23
+ const hideSeparator = inject('hideSeparator', false);
24
24
 
25
25
  const attrs = useAttrs();
26
26
  const classAttribute = attrs.class as string;
27
27
 
28
28
  const { settings } = useSettings();
29
- const isUnstyled =
30
- settings.global.unstyled || settings.components.cardHeader.unstyled || props.unstyled;
29
+ const isUnstyled = settings.global.unstyled || settings.components.cardHeader.unstyled || props.unstyled;
31
30
  </script>
32
31
 
33
32
  <template>
@@ -1,21 +1,21 @@
1
- import { mount } from "@vue/test-utils";
2
- import { describe, expect, test, vi } from "vitest";
3
- import { VCodeBlock } from "../..";
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, expect, test, vi } from 'vitest';
3
+ import { VCodeBlock } from '../..';
4
4
 
5
5
  const clipboardMock = {
6
6
  writeText: vi.fn(),
7
7
  };
8
8
 
9
- Object.defineProperty(window.navigator, "clipboard", {
9
+ Object.defineProperty(window.navigator, 'clipboard', {
10
10
  value: clipboardMock,
11
11
  writable: true,
12
12
  });
13
13
 
14
- describe("VCodeBlock", () => {
15
- test("copy button copies code to clipboard", async () => {
14
+ describe('VCodeBlock', () => {
15
+ test('copy button copies code to clipboard', async () => {
16
16
  const mockClipboardDirective = {
17
17
  mounted(el: HTMLElement, binding: any) {
18
- el.addEventListener("click", () => {
18
+ el.addEventListener('click', () => {
19
19
  el.dataset.copied = binding.value;
20
20
  });
21
21
  },
@@ -23,7 +23,7 @@ describe("VCodeBlock", () => {
23
23
 
24
24
  const wrapper = mount(VCodeBlock, {
25
25
  props: {
26
- code: "John Duck",
26
+ code: 'John Duck',
27
27
  },
28
28
  global: {
29
29
  directives: {
@@ -32,32 +32,32 @@ describe("VCodeBlock", () => {
32
32
  },
33
33
  });
34
34
 
35
- await wrapper.find(".vuetiful-code-block-button").trigger("click");
35
+ await wrapper.find('.vuetiful-code-block-button').trigger('click');
36
36
 
37
- expect(clipboardMock.writeText).toHaveBeenCalledWith("John Duck");
37
+ expect(clipboardMock.writeText).toHaveBeenCalledWith('John Duck');
38
38
 
39
39
  await new Promise((resolve) => setTimeout(resolve, 2000));
40
40
 
41
- expect(wrapper.emitted("copy")).toBeTruthy();
41
+ expect(wrapper.emitted('copy')).toBeTruthy();
42
42
  });
43
43
 
44
- test("renders the component with default props", () => {
44
+ test('renders the component with default props', () => {
45
45
  const wrapper = mount(VCodeBlock);
46
46
  expect(wrapper.exists()).toBe(true);
47
- expect(wrapper.text()).toContain("Copy");
48
- expect(wrapper.find(".vuetiful-code-block-language").text()).toBe("plaintext");
49
- expect(wrapper.find(".vuetiful-code-block-code").classes()).toContain("language-plaintext");
47
+ expect(wrapper.text()).toContain('Copy');
48
+ expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('plaintext');
49
+ expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-plaintext');
50
50
  });
51
51
 
52
- test("renders the component with custom props", () => {
52
+ test('renders the component with custom props', () => {
53
53
  const customProps = {
54
- language: "javascript",
55
- code: "const x = 10;",
56
- buttonText: "Copy Code",
57
- buttonCopiedText: "Copied!",
58
- classButton: "custom-button-class",
59
- classLanguage: "custom-language-class",
60
- classCode: "custom-code-class",
54
+ language: 'javascript',
55
+ code: 'const x = 10;',
56
+ buttonText: 'Copy Code',
57
+ buttonCopiedText: 'Copied!',
58
+ classButton: 'custom-button-class',
59
+ classLanguage: 'custom-language-class',
60
+ classCode: 'custom-code-class',
61
61
  preventOverflow: true,
62
62
  };
63
63
 
@@ -65,69 +65,69 @@ describe("VCodeBlock", () => {
65
65
  props: customProps,
66
66
  });
67
67
 
68
- expect(wrapper.find(".vuetiful-code-block-button").text()).toContain("Copy Code");
69
- expect(wrapper.find(".vuetiful-code-block-language").text()).toBe("javascript");
70
- expect(wrapper.find(".vuetiful-code-block-code").classes()).toContain("language-javascript");
71
- expect(wrapper.find(".vuetiful-code-block-pre").classes()).toContain("whitespace-pre-wrap");
68
+ expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
69
+ expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('javascript');
70
+ expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-javascript');
71
+ expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
72
72
  });
73
73
 
74
- test("renders the component with custom props", () => {
74
+ test('renders the component with custom props', () => {
75
75
  const customProps = {
76
- language: "js",
77
- code: "const x = 10;",
78
- buttonText: "Copy Code",
79
- buttonCopiedText: "Copied!",
80
- classButton: "custom-button-class",
81
- classLanguage: "custom-language-class",
82
- classCode: "custom-code-class",
76
+ language: 'js',
77
+ code: 'const x = 10;',
78
+ buttonText: 'Copy Code',
79
+ buttonCopiedText: 'Copied!',
80
+ classButton: 'custom-button-class',
81
+ classLanguage: 'custom-language-class',
82
+ classCode: 'custom-code-class',
83
83
  preventOverflow: true,
84
84
  };
85
85
 
86
86
  const wrapper = mount(VCodeBlock, { props: customProps });
87
87
 
88
- expect(wrapper.find(".vuetiful-code-block-button").text()).toContain("Copy Code");
89
- expect(wrapper.find(".vuetiful-code-block-language").text()).toBe("javascript");
90
- expect(wrapper.find(".vuetiful-code-block-code").classes()).toContain("language-js");
91
- expect(wrapper.find(".vuetiful-code-block-pre").classes()).toContain("whitespace-pre-wrap");
88
+ expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
89
+ expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('javascript');
90
+ expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-js');
91
+ expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
92
92
  });
93
93
 
94
- test("renders the component with custom props", () => {
94
+ test('renders the component with custom props', () => {
95
95
  const customProps = {
96
- language: "ts",
97
- code: "const x = 10;",
98
- buttonText: "Copy Code",
99
- buttonCopiedText: "Copied!",
100
- classButton: "custom-button-class",
101
- classLanguage: "custom-language-class",
102
- classCode: "custom-code-class",
96
+ language: 'ts',
97
+ code: 'const x = 10;',
98
+ buttonText: 'Copy Code',
99
+ buttonCopiedText: 'Copied!',
100
+ classButton: 'custom-button-class',
101
+ classLanguage: 'custom-language-class',
102
+ classCode: 'custom-code-class',
103
103
  preventOverflow: true,
104
104
  };
105
105
 
106
106
  const wrapper = mount(VCodeBlock, { props: customProps });
107
107
 
108
- expect(wrapper.find(".vuetiful-code-block-button").text()).toContain("Copy Code");
109
- expect(wrapper.find(".vuetiful-code-block-language").text()).toBe("typescript");
110
- expect(wrapper.find(".vuetiful-code-block-code").classes()).toContain("language-ts");
111
- expect(wrapper.find(".vuetiful-code-block-pre").classes()).toContain("whitespace-pre-wrap");
108
+ expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
109
+ expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('typescript');
110
+ expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-ts');
111
+ expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
112
112
  });
113
113
 
114
- test("renders the component with custom props", () => {
114
+ test('renders the component with custom props', () => {
115
115
  const customProps = {
116
- language: "sh",
117
- code: "const x = 10;",
118
- buttonText: "Copy Code",
119
- buttonCopiedText: "Copied!",
120
- classButton: "custom-button-class",
121
- classLanguage: "custom-language-class",
122
- classCode: "custom-code-class",
116
+ language: 'sh',
117
+ code: 'const x = 10;',
118
+ buttonText: 'Copy Code',
119
+ buttonCopiedText: 'Copied!',
120
+ classButton: 'custom-button-class',
121
+ classLanguage: 'custom-language-class',
122
+ classCode: 'custom-code-class',
123
123
  preventOverflow: true,
124
124
  };
125
125
 
126
126
  const wrapper = mount(VCodeBlock, { props: customProps });
127
127
 
128
- expect(wrapper.find(".vuetiful-code-block-button").text()).toContain("Copy Code");
129
- expect(wrapper.find(".vuetiful-code-block-language").text()).toBe("console");
130
- expect(wrapper.find(".vuetiful-code-block-code").classes()).toContain("language-sh");
131
- expect(wrapper.find(".vuetiful-code-block-pre").classes()).toContain("whitespace-pre-wrap");
128
+ expect(wrapper.find('.vuetiful-code-block-button').text()).toContain('Copy Code');
129
+ expect(wrapper.find('.vuetiful-code-block-language').text()).toBe('console');
130
+ expect(wrapper.find('.vuetiful-code-block-code').classes()).toContain('language-sh');
131
+ expect(wrapper.find('.vuetiful-code-block-pre').classes()).toContain('whitespace-pre-wrap');
132
132
  });
133
133
  });