dashboard-shell-shell 1.0.113 → 1.0.114

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 (119) hide show
  1. package/components/ActionDropdown.vue +1 -1
  2. package/components/ActionMenu.vue +2 -2
  3. package/components/ActionMenuShell.vue +0 -1
  4. package/components/AppModal.vue +6 -78
  5. package/components/AssignTo.vue +11 -25
  6. package/components/AsyncButton.vue +7 -24
  7. package/components/BannerGraphic.vue +0 -1
  8. package/components/ButtonDropdown.vue +4 -26
  9. package/components/ButtonGroup.vue +0 -4
  10. package/components/ButtonMultiAction.vue +0 -1
  11. package/components/CommunityLinks.vue +3 -3
  12. package/components/ConsumptionGauge.vue +5 -24
  13. package/components/CopyToClipboardText.vue +1 -2
  14. package/components/CruResource.vue +7 -12
  15. package/components/CruResourceFooter.vue +2 -2
  16. package/components/DashboardOptions.vue +15 -21
  17. package/components/DetailText.vue +0 -5
  18. package/components/DisableAuthProviderModal.vue +0 -1
  19. package/components/ExplorerMembers.vue +1 -1
  20. package/components/ExplorerProjectsNamespaces.vue +14 -56
  21. package/components/FixedBanner.vue +12 -19
  22. package/components/GlobalRoleBindings.vue +1 -5
  23. package/components/GrafanaDashboard.vue +4 -4
  24. package/components/GrowlManager.vue +1 -4
  25. package/components/HardwareResourceGauge.vue +3 -39
  26. package/components/InfoBox.vue +3 -3
  27. package/components/InputOrDisplay.vue +2 -28
  28. package/components/LabelValue.vue +1 -16
  29. package/components/LandingPagePreference.vue +3 -5
  30. package/components/LocaleSelector.vue +93 -39
  31. package/components/ModalWithCard.vue +0 -2
  32. package/components/MoveModal.vue +0 -1
  33. package/components/PromptChangePassword.vue +1 -1
  34. package/components/PromptModal.vue +2 -15
  35. package/components/PromptRemove.vue +8 -28
  36. package/components/PromptRestore.vue +0 -1
  37. package/components/ResourceCancelModal.vue +0 -1
  38. package/components/ResourceDetail/Masthead.vue +43 -188
  39. package/components/ResourceDetail/__tests__/Masthead.test.ts +1 -5
  40. package/components/ResourceDetail/index.vue +14 -49
  41. package/components/ResourceList/Masthead.vue +18 -80
  42. package/components/ResourceTable.vue +19 -60
  43. package/components/SideNav.vue +12 -32
  44. package/components/SortableTable/THead.vue +5 -34
  45. package/components/SortableTable/actions.js +1 -1
  46. package/components/SortableTable/index.vue +142 -649
  47. package/components/SortableTable/paging.js +28 -36
  48. package/components/SortableTable/selection.js +11 -0
  49. package/components/Tabbed/Tab.vue +3 -3
  50. package/components/Tabbed/index.vue +26 -44
  51. package/components/Wizard.vue +2 -2
  52. package/components/__tests__/AsyncButton.test.ts +2 -2
  53. package/components/__tests__/FixedBanner.test.ts +3 -3
  54. package/components/auth/Principal.vue +3 -10
  55. package/components/auth/__tests__/RoleDetailEdit.test.ts +2 -3
  56. package/components/form/ArrayList.vue +85 -123
  57. package/components/form/ArrayListGrouped.vue +2 -10
  58. package/components/form/Command.vue +15 -6
  59. package/components/form/EnvVars.vue +8 -16
  60. package/components/form/Footer.vue +5 -8
  61. package/components/form/HealthCheck.vue +3 -3
  62. package/components/form/HookOption.vue +16 -11
  63. package/components/form/KeyValue.vue +7 -16
  64. package/components/form/LabeledSelect.vue +76 -59
  65. package/components/form/LifecycleHooks.vue +3 -3
  66. package/components/form/MatchExpressions.vue +12 -35
  67. package/components/form/NameNsDescription.vue +115 -147
  68. package/components/form/Networking.vue +12 -20
  69. package/components/form/NodeAffinity.vue +23 -31
  70. package/components/form/NodeScheduling.vue +3 -13
  71. package/components/form/Password.vue +5 -11
  72. package/components/form/PodAffinity.vue +44 -43
  73. package/components/form/Probe.vue +66 -68
  74. package/components/form/ResourceQuota/Project.vue +1 -5
  75. package/components/form/ResourceSelector.vue +9 -7
  76. package/components/form/SSHKnownHosts/KnownHostsEditDialog.vue +3 -6
  77. package/components/form/SSHKnownHosts/__tests__/KnownHostsEditDialog.test.ts +1 -12
  78. package/components/form/SSHKnownHosts/index.vue +2 -16
  79. package/components/form/Security.vue +56 -54
  80. package/components/form/Select.vue +7 -41
  81. package/components/form/ShellInput.vue +1 -5
  82. package/components/form/Tolerations.vue +1 -5
  83. package/components/form/UnitInput.vue +2 -2
  84. package/components/form/ValueFromResource.vue +121 -134
  85. package/components/form/WorkloadPorts.vue +18 -18
  86. package/components/form/__tests__/ArrayList.test.ts +2 -5
  87. package/components/form/__tests__/MatchExpressions.test.ts +12 -12
  88. package/components/form/__tests__/NameNsDescription.test.ts +14 -115
  89. package/components/form/__tests__/Probe.test.ts +8 -12
  90. package/components/form/__tests__/SSHKnownHosts.test.ts +0 -11
  91. package/components/form/__tests__/Select.test.ts +0 -37
  92. package/components/form/__tests__/UnitInput.test.ts +5 -4
  93. package/components/formatter/BadgeStateFormatter.vue +5 -8
  94. package/components/formatter/ExtensionCache.vue +74 -0
  95. package/components/formatter/InternalExternalIP.vue +0 -2
  96. package/components/formatter/Port.vue +24 -0
  97. package/components/formatter/SecretData.vue +7 -20
  98. package/components/formatter/SecretType.vue +41 -0
  99. package/components/nav/Favorite.vue +1 -5
  100. package/components/nav/Group.vue +27 -60
  101. package/components/nav/Header.vue +13 -39
  102. package/components/nav/Jump.vue +0 -7
  103. package/components/nav/NamespaceFilter.vue +8 -14
  104. package/components/nav/Pinned.vue +1 -1
  105. package/components/nav/TopLevelMenu.vue +17 -5
  106. package/components/nav/Type.vue +35 -32
  107. package/components/nav/__tests__/TopLevelMenu.test.ts +40 -0
  108. package/components/templates/blank.vue +1 -4
  109. package/components/templates/default.vue +0 -8
  110. package/components/templates/home.vue +1 -10
  111. package/components/templates/plain.vue +1 -10
  112. package/package.json +1 -1
  113. package/components/ActionDropdownShell.vue +0 -71
  114. package/components/DotState.vue +0 -84
  115. package/components/ModalManager.vue +0 -55
  116. package/components/SlideInPanelManager.vue +0 -126
  117. package/components/StatusBadge.vue +0 -77
  118. package/components/__tests__/ModalManager.spec.ts +0 -176
  119. package/components/__tests__/SlideInPanelManager.spec.ts +0 -166
@@ -1,71 +0,0 @@
1
- <script setup lang="ts">
2
- import { RcDropdown, RcDropdownTrigger, RcDropdownItem } from '@components/RcDropdown';
3
- type HiddenAction = {
4
- action: string;
5
- enabled: boolean;
6
- icon: string;
7
- label: string;
8
- bulkable: boolean;
9
- bulkAction: string;
10
- allEnabled: boolean;
11
- anyEnabled: boolean;
12
- }
13
-
14
- defineProps<{
15
- disabled: boolean,
16
- hiddenActions: HiddenAction[],
17
- actionTooltip: unknown,
18
- }>();
19
-
20
- const emit = defineEmits(['click', 'mouseover', 'mouseleave']);
21
-
22
- const applyTableAction = (act: HiddenAction, args: unknown, event: Event) => {
23
- emit('click', act, args, event);
24
- };
25
-
26
- const setBulkActionOfInterest = (act: HiddenAction | null, event: 'mouseover' | 'mouseleave' = 'mouseover') => {
27
- emit(event, act);
28
- };
29
- </script>
30
-
31
- <template>
32
- <rc-dropdown
33
- :distance="14"
34
- placement="bottom"
35
- >
36
- <rc-dropdown-trigger
37
- class="bulk-actions-dropdown"
38
- :disabled="disabled"
39
- >
40
- <template #before>
41
- <i class="icon icon-gear" />
42
- </template>
43
- <span>{{ t('sortableTable.bulkActions.collapsed.label') }}</span>
44
- <template #after>
45
- <i class="ml-10 icon icon-chevron-down" />
46
- </template>
47
- </rc-dropdown-trigger>
48
- <template #dropdownCollection>
49
- <rc-dropdown-item
50
- v-for="(act, i) in hiddenActions"
51
- :key="i"
52
- v-clean-tooltip="{
53
- content: actionTooltip,
54
- placement: 'right'
55
- }"
56
- :disabled="!act.enabled"
57
- @click="applyTableAction(act, null, $event)"
58
- @mouseover="setBulkActionOfInterest(act)"
59
- @mouseleave="setBulkActionOfInterest(null, 'mouseleave')"
60
- >
61
- <template #before>
62
- <i
63
- v-if="act.icon"
64
- :class="act.icon"
65
- />
66
- </template>
67
- <span v-clean-html="act.label" />
68
- </rc-dropdown-item>
69
- </template>
70
- </rc-dropdown>
71
- </template>
@@ -1,84 +0,0 @@
1
- <script lang="ts">
2
- import Vue, { PropType, defineComponent } from 'vue';
3
- import { mapGetters } from 'vuex';
4
-
5
- interface Dot {
6
- stateBackground: string;
7
- stateDisplay: string;
8
- }
9
-
10
- export default defineComponent({
11
-
12
- name: 'DotState',
13
-
14
- props: {
15
- value: {
16
- type: Object as PropType<Dot>,
17
- default: null
18
- },
19
- color: {
20
- type: String,
21
- default: null
22
- },
23
- label: {
24
- type: String,
25
- default: null
26
- }
27
- },
28
-
29
- computed: {
30
- ...mapGetters({ t: 'i18n/t' }),
31
- bg(): string | null {
32
- return this.value?.stateBackground || this.color;
33
- },
34
-
35
- msg(): string | null {
36
- let text = this.value?.stateDisplay || this.label;
37
- let zhText = this.t(`stateLabel.${ text }`)
38
- return zhText ? zhText : text
39
- }
40
-
41
- }
42
- });
43
- </script>
44
-
45
- <template>
46
- <div style="display: flex;flex-direction: row;align-items: center;">
47
- <div :class="{ [bg]: true }"></div>
48
- <span style="margin-left: 5px;">{{ msg }}</span>
49
-
50
- </div>
51
-
52
- </template>
53
- <style lang="scss" scoped>
54
- .bg-error {
55
- width: 10px; /* 圆点的宽度 */
56
- height: 10px; /* 圆点的高度 */
57
- background-color: #DD0C17; /* 圆点的颜色 */
58
- border-radius: 50%; /* 设置为圆形 */
59
- }
60
- .bg-darker {
61
- width: 10px; /* 圆点的宽度 */
62
- height: 10px; /* 圆点的高度 */
63
- background-color: #DD0C17; /* 圆点的颜色 */
64
- border-radius: 50%; /* 设置为圆形 */
65
- }
66
- .bg-success {
67
- width: 10px; /* 圆点的宽度 */
68
- height: 10px; /* 圆点的高度 */
69
- background-color: #95F204 !important; /* 圆点的颜色 */
70
- border-radius: 50%; /* 设置为圆形 */
71
- }
72
- .bg-warning {
73
- width: 10px; /* 圆点的宽度 */
74
- height: 10px; /* 圆点的高度 */
75
- background-color: #DAC342; /* 圆点的颜色 */
76
- border-radius: 50%; /* 设置为圆形 */
77
- }
78
- .bg-info {
79
- width: 10px; /* 圆点的宽度 */
80
- height: 10px; /* 圆点的高度 */
81
- background-color: #1890FF; /* 圆点的颜色 */
82
- border-radius: 50%; /* 设置为圆形 */
83
- }
84
- </style>
@@ -1,55 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed, ref } from 'vue';
3
- import { useStore } from 'vuex';
4
-
5
- import AppModal from '@shell/components/AppModal.vue';
6
-
7
- const store = useStore();
8
-
9
- const isOpen = computed(() => store.getters['modal/isOpen']);
10
- const component = computed(() => store.getters['modal/component']);
11
- const componentProps = computed(() => store.getters['modal/componentProps']);
12
- const resources = computed(() => store.getters['modal/resources']);
13
- const closeOnClickOutside = computed(() => store.getters['modal/closeOnClickOutside']);
14
- const modalWidth = computed(() => store.getters['modal/modalWidth']);
15
- // const modalSticky = computed(() => store.getters['modal/modalSticky']); // TODO: Implement sticky modals
16
-
17
- const backgroundClosing = ref<Function | null>(null);
18
-
19
- function close() {
20
- if (!isOpen.value) return;
21
-
22
- if (backgroundClosing.value) {
23
- backgroundClosing.value();
24
- }
25
-
26
- store.commit('modal/closeModal');
27
- }
28
-
29
- function registerBackgroundClosing(fn: Function) {
30
- backgroundClosing.value = fn;
31
- }
32
- </script>
33
-
34
- <template>
35
- <Teleport to="#modals">
36
- <app-modal
37
- v-if="isOpen && component"
38
- :click-to-close="closeOnClickOutside"
39
- :width="modalWidth"
40
- :style="{ '--prompt-modal-width': modalWidth }"
41
- :trigger-focus-trap="true"
42
- tabindex="0"
43
- @close="close"
44
- >
45
- <component
46
- :is="component"
47
- v-bind="componentProps || {}"
48
- data-testid="modal-manager-component"
49
- :resources="resources"
50
- :register-background-closing="registerBackgroundClosing"
51
- @close="close"
52
- />
53
- </app-modal>
54
- </Teleport>
55
- </template>
@@ -1,126 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed } from 'vue';
3
- import { useStore } from 'vuex';
4
-
5
- const HEADER_HEIGHT = 55;
6
-
7
- const store = useStore();
8
- const isOpen = computed(() => store.getters['slideInPanel/isOpen']);
9
- const currentComponent = computed(() => store.getters['slideInPanel/component']);
10
- const currentProps = computed(() => store.getters['slideInPanel/componentProps']);
11
-
12
- const panelTop = computed(() => {
13
- const banner = document.getElementById('banner-header');
14
- let height = HEADER_HEIGHT;
15
-
16
- if (banner) {
17
- height += banner.clientHeight;
18
- }
19
-
20
- return `${ height }px`;
21
- });
22
-
23
- const panelHeight = computed(() => `calc(100vh - ${ panelTop?.value })`);
24
- const panelWidth = computed(() => currentProps?.value?.width || '33%');
25
- const panelRight = computed(() => (isOpen?.value ? '0' : `-${ panelWidth?.value }`));
26
-
27
- const panelTitle = computed(() => currentProps?.value?.title || 'Details');
28
-
29
- function closePanel() {
30
- store.commit('slideInPanel/close');
31
- }
32
- </script>
33
-
34
- <template>
35
- <Teleport to="#slides">
36
- <div id="slide-in-panel-manager">
37
- <div
38
- v-show="isOpen"
39
- data-testid="slide-in-glass"
40
- class="slide-in-glass"
41
- :class="{ 'slide-in-glass-open': isOpen }"
42
- @click="closePanel"
43
- />
44
- <div
45
- class="slide-in"
46
- :class="{ 'slide-in-open': isOpen }"
47
- :style="{ width: panelWidth, right: panelRight, top: panelTop, height: panelHeight }"
48
- >
49
- <div class="header">
50
- <div class="title">
51
- {{ panelTitle }}
52
- </div>
53
- <i
54
- class="icon icon-close"
55
- data-testid="slide-in-close"
56
- :trigger-focus-trap="true"
57
- tabindex="0"
58
- @click="closePanel"
59
- />
60
- </div>
61
- <div class="main-panel">
62
- <component
63
- :is="currentComponent"
64
- v-if="isOpen || currentComponent"
65
- v-bind="currentProps"
66
- data-testid="slide-in-panel-component"
67
- class="dynamic-panel-content"
68
- />
69
- </div>
70
- </div>
71
- </div>
72
- </Teleport>
73
- </template>
74
-
75
- <style lang="scss" scoped>
76
- .slide-in-glass {
77
- display: none;
78
- position: fixed;
79
- top: 0;
80
- left: 0;
81
- height: 100vh;
82
- width: 100vw;
83
- }
84
- .slide-in-glass-open {
85
- background-color: var(--body-bg);
86
- display: block;
87
- opacity: 0.5;
88
- z-index: 1000;
89
- }
90
-
91
- .slide-in {
92
- display: flex;
93
- flex-direction: column;
94
- position: fixed;
95
- top: 0;
96
- z-index: 2000;
97
- transition: right 0.5s ease;
98
- border-left: 1px solid var(--border);
99
- background-color: var(--body-bg);
100
- }
101
-
102
- .slide-in-open {
103
- right: 0;
104
- }
105
-
106
- .header {
107
- display: flex;
108
- align-items: center;
109
- padding: 4px;
110
- border-bottom: 1px solid var(--border);
111
-
112
- .title {
113
- flex: 1;
114
- font-weight: bold;
115
- }
116
-
117
- .icon-close {
118
- cursor: pointer;
119
- }
120
- }
121
-
122
- .main-panel {
123
- padding: 10px;
124
- overflow: auto;
125
- }
126
- </style>
@@ -1,77 +0,0 @@
1
- <script setup lang="ts">
2
-
3
- const STATUS = {
4
- success: {
5
- color: 'text-success',
6
- icon: 'icon-checkmark'
7
- },
8
- warning: {
9
- color: 'text-warning',
10
- icon: 'icon-warning'
11
- },
12
- info: {
13
- color: 'text-info',
14
- icon: 'icon-info'
15
- },
16
- error: {
17
- color: 'text-error',
18
- icon: 'icon-error'
19
- }
20
- };
21
-
22
- withDefaults(
23
- defineProps<{
24
- status?: 'success' | 'warning' | 'info' | 'error',
25
- label?: string
26
- }>(),
27
- {
28
- status: 'success',
29
- label: '',
30
- }
31
- );
32
-
33
- </script>
34
- <template>
35
- <div
36
- class="status-badge"
37
- >
38
- <i
39
- class="status-badge__icon icon"
40
- :class="{
41
- [STATUS[status].icon]: true,
42
- [STATUS[status].color]: true
43
- }"
44
- />
45
- <div
46
- v-if="label"
47
- class="status-badge__label"
48
- >
49
- {{ label }}
50
- </div>
51
- </div>
52
- </template>
53
-
54
- <style lang="scss" scoped>
55
- .status-badge {
56
- align-items: center;
57
- display: inline-flex;
58
- border: 1px solid;
59
- border-color: var(--border);
60
- margin-top: 20px;
61
-
62
- & + & {
63
- margin-left: 20px;
64
- }
65
-
66
- &__label {
67
- border-left: 1px solid var(--border);
68
- padding: 5px 20px;
69
- color: var(--body-text);
70
- }
71
-
72
- &__icon {
73
- text-align: center;
74
- padding: 5px 10px;
75
- }
76
- }
77
- </style>
@@ -1,176 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { createStore, Store } from 'vuex';
3
- import { nextTick } from 'vue';
4
-
5
- import ModalManager from '@shell/components/ModalManager.vue';
6
-
7
- interface ModalManagerMethods {
8
- registerBackgroundClosing(fn: Function): void;
9
- close(): void;
10
- }
11
-
12
- const MockComponent = {
13
- template: '<div data-testid="modal-manager-component">Mock Content</div>',
14
- props: ['someProp', 'resources', 'registerBackgroundClosing']
15
- };
16
-
17
- describe('modalManager.vue with Teleport', () => {
18
- let store: Store<any>;
19
- let getters: Record<string, () => any>;
20
- let modalsDiv: HTMLDivElement;
21
-
22
- beforeEach(() => {
23
- // Create the teleport target container
24
- modalsDiv = document.createElement('div');
25
- modalsDiv.setAttribute('id', 'modals');
26
- document.body.appendChild(modalsDiv);
27
-
28
- getters = {
29
- 'modal/isOpen': () => true,
30
- 'modal/component': () => MockComponent,
31
- 'modal/componentProps': () => ({ someProp: 'testValue' }),
32
- 'modal/resources': () => ({ data: 'mockData' }),
33
- 'modal/closeOnClickOutside': () => true,
34
- 'modal/modalWidth': () => '500px'
35
- };
36
-
37
- store = createStore({
38
- getters,
39
- mutations: { 'modal/closeModal': jest.fn() }
40
- });
41
- });
42
-
43
- afterEach(() => {
44
- // Clean up the teleport container after each test
45
- document.body.removeChild(modalsDiv);
46
- });
47
-
48
- const factory = () => {
49
- return mount(ModalManager, {
50
- attachTo: document.body, // attach so Teleport can work properly
51
- global: {
52
- plugins: [store],
53
- stubs: {
54
- AppModal: {
55
- name: 'AppModal',
56
- template: `<div data-testid="app-modal" @close="$emit('close')" :style="{ '--prompt-modal-width': width }"><slot /></div>`,
57
- props: ['clickToClose', 'width']
58
- }
59
- }
60
- }
61
- });
62
- };
63
-
64
- it('renders the AppModal and dynamic component when modal is open', async() => {
65
- factory();
66
-
67
- await nextTick();
68
-
69
- // Because Teleport moves content out of the normal wrapper,
70
- // we query the document for the teleported elements.
71
- const appModal = document.querySelector('[data-testid="app-modal"]');
72
- const dynamicComponent = document.querySelector('[data-testid="modal-manager-component"]');
73
-
74
- expect(appModal).toBeTruthy();
75
- expect(dynamicComponent).toBeTruthy();
76
- expect(appModal?.getAttribute('style')).toContain('--prompt-modal-width: 500px');
77
-
78
- // We assume the mock component is rendered correctly if its markup is found.
79
- });
80
-
81
- it('does not render the AppModal when modal is closed', async() => {
82
- getters['modal/isOpen'] = () => false;
83
- store = createStore({
84
- getters,
85
- mutations: { 'modal/closeModal': jest.fn() }
86
- });
87
- factory();
88
- await nextTick();
89
-
90
- const appModal = document.querySelector('[data-testid="app-modal"]');
91
-
92
- expect(appModal).toBeNull();
93
- });
94
-
95
- it('does not render the AppModal when dynamic component is null', async() => {
96
- getters['modal/component'] = () => null;
97
- store = createStore({
98
- getters,
99
- mutations: { 'modal/closeModal': jest.fn() }
100
- });
101
- factory();
102
- await nextTick();
103
-
104
- const appModal = document.querySelector('[data-testid="app-modal"]');
105
-
106
- expect(appModal).toBeNull();
107
- });
108
-
109
- it('calls store commit when close is triggered', async() => {
110
- const closeModalMutation = jest.fn();
111
-
112
- getters['modal/isOpen'] = () => true;
113
- store = createStore({
114
- getters,
115
- mutations: { 'modal/closeModal': closeModalMutation }
116
- });
117
- const wrapper = factory();
118
-
119
- await nextTick();
120
-
121
- const appModalWrapper = wrapper.findComponent({ name: 'AppModal' });
122
-
123
- appModalWrapper.vm.$emit('close');
124
- await nextTick();
125
-
126
- expect(closeModalMutation).toHaveBeenCalledWith({}, undefined);
127
- });
128
-
129
- it('calls registered background closing function on close', async() => {
130
- const closeModalMutation = jest.fn();
131
-
132
- getters['modal/isOpen'] = () => true;
133
- store = createStore({
134
- getters,
135
- mutations: { 'modal/closeModal': closeModalMutation }
136
- });
137
- const wrapper = factory();
138
-
139
- await nextTick();
140
-
141
- const backgroundFn = jest.fn();
142
-
143
- (wrapper.vm as unknown as ModalManagerMethods).registerBackgroundClosing(backgroundFn);
144
- await nextTick();
145
-
146
- const appModalWrapper = wrapper.findComponent({ name: 'AppModal' });
147
-
148
- appModalWrapper.vm.$emit('close');
149
- await nextTick();
150
-
151
- expect(backgroundFn).toHaveBeenCalledWith();
152
- expect(closeModalMutation).toHaveBeenCalledWith({}, undefined);
153
- });
154
-
155
- it('does nothing if modal is already closed when close is triggered', async() => {
156
- const closeModalMutation = jest.fn();
157
-
158
- getters['modal/isOpen'] = () => false;
159
- store = createStore({
160
- getters,
161
- mutations: { 'modal/closeModal': closeModalMutation }
162
- });
163
- const wrapper = factory();
164
-
165
- await nextTick();
166
-
167
- const modalManager = wrapper.vm as unknown as ModalManagerMethods;
168
- const spy = jest.spyOn(modalManager, 'close');
169
-
170
- modalManager.close();
171
- await nextTick();
172
-
173
- expect(spy).toHaveBeenCalledWith();
174
- expect(closeModalMutation).not.toHaveBeenCalled();
175
- });
176
- });