@code-coaching/vuetiful 0.21.0 → 0.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-coaching/vuetiful",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "onchange 'src/**/*.vue' 'src/**/*.ts' 'src/**/*.css' -- npm run build",
@@ -32,7 +32,7 @@ describe("VAlert", () => {
32
32
 
33
33
  describe("given close icon is clicked", () => {
34
34
  test("should emit close", async () => {
35
- const wrapper = mount(VAlert);
35
+ const wrapper = mount(VAlert, { props: { showClose: true } });
36
36
  await wrapper.find("[data-test=close]").trigger("click");
37
37
  expect(wrapper.emitted()["close"][0]).toEqual([]);
38
38
 
@@ -53,7 +53,7 @@ describe("VAlert", () => {
53
53
  });
54
54
  expect(wrapper.text()).toContain("John Duck");
55
55
  });
56
- })
56
+ });
57
57
 
58
58
  describe("given a actions slot is provided", () => {
59
59
  test("should render the actions slot", () => {
@@ -64,7 +64,7 @@ describe("VAlert", () => {
64
64
  });
65
65
  expect(wrapper.text()).toContain("John Duck");
66
66
  });
67
- })
67
+ });
68
68
 
69
69
  describe("given hide-icon prop is present", () => {
70
70
  test("should not render an icon", () => {
@@ -73,18 +73,18 @@ describe("VAlert", () => {
73
73
  hideIcon: true,
74
74
  },
75
75
  });
76
- expect(wrapper.findAll(".icon").length).toBe(1);
76
+ expect(wrapper.findAll(".icon").length).toBe(0);
77
77
  });
78
- })
78
+ });
79
79
 
80
- describe("given hide-close prop is present", () => {
81
- test("should not render a close icon", () => {
80
+ describe("given show-close prop is present", () => {
81
+ test("should render a close icon", () => {
82
82
  const wrapper = mount(VAlert, {
83
83
  props: {
84
- hideClose: true,
84
+ showClose: true,
85
85
  },
86
86
  });
87
- expect(wrapper.find("[data-test=close]").exists()).toBe(false);
87
+ expect(wrapper.find("[data-test=close]").exists()).toBe(true);
88
88
  });
89
- })
89
+ });
90
90
  });
@@ -7,7 +7,7 @@ const props = defineProps({
7
7
  type: Boolean,
8
8
  default: false,
9
9
  },
10
- hideClose: {
10
+ showClose: {
11
11
  type: Boolean,
12
12
  default: false,
13
13
  },
@@ -111,7 +111,7 @@ const handleKeydown = (event: KeyboardEvent) => {
111
111
  <!-- https://fontawesome.com/icons/xmark?f=classic&s=solid -->
112
112
  <svg
113
113
  data-test="close"
114
- v-if="!hideClose"
114
+ v-if="showClose"
115
115
  tabindex="0"
116
116
  @keydown="handleKeydown"
117
117
  @click="close"
@@ -1,4 +1,4 @@
1
- import { readonly, Ref, ref } from "vue";
1
+ import { computed, readonly, Ref, ref } from "vue";
2
2
  import { usePlatform } from "../utils/platform/platform.service";
3
3
 
4
4
  const { isBrowser } = usePlatform();
@@ -11,6 +11,7 @@ const MODE = {
11
11
  const modeOsPrefers = ref(MODE.DARK);
12
12
  const currentMode = ref(MODE.DARK);
13
13
  const modeUserPrefers: Ref<boolean | undefined> = ref(undefined);
14
+ const isDark = computed(() => currentMode.value === MODE.DARK);
14
15
 
15
16
  const useDarkMode = () => {
16
17
  const getModeOsPrefers = (): boolean => {
@@ -78,6 +79,7 @@ const useDarkMode = () => {
78
79
  modeOsPrefers: readonly(modeOsPrefers),
79
80
  modeUserPrefers: readonly(modeUserPrefers),
80
81
  currentMode: readonly(currentMode),
82
+ isDark: readonly(isDark),
81
83
  getModeOsPrefers,
82
84
  getModeUserPrefers,
83
85
  getModeAutoPrefers,