@rancher/shell 2.0.0 → 2.0.2-rc.1

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 (154) hide show
  1. package/assets/translations/en-us.yaml +69 -29
  2. package/assets/translations/zh-hans.yaml +1 -0
  3. package/components/AlertTable.vue +17 -7
  4. package/components/AssignTo.vue +2 -0
  5. package/components/GrafanaDashboard.vue +6 -4
  6. package/components/PromptRemove.vue +1 -0
  7. package/components/Questions/index.vue +2 -2
  8. package/components/auth/RoleDetailEdit.vue +5 -4
  9. package/components/form/KeyValue.vue +1 -0
  10. package/components/form/Members/ClusterPermissionsEditor.vue +1 -1
  11. package/components/form/ProjectMemberEditor.vue +1 -1
  12. package/components/form/ResourceLabeledSelect.vue +11 -3
  13. package/components/form/Taints.vue +13 -7
  14. package/components/form/__tests__/Taints.test.ts +70 -0
  15. package/components/form/labeled-select-utils/labeled-select.utils.ts +1 -1
  16. package/components/nav/Header.vue +1 -1
  17. package/components/nav/TopLevelMenu.vue +1 -4
  18. package/config/pagination-table-headers.js +5 -4
  19. package/config/product/auth.js +1 -1
  20. package/config/roles.ts +34 -19
  21. package/config/router/navigation-guards/attempt-first-login.js +1 -1
  22. package/config/router/navigation-guards/authentication.js +1 -1
  23. package/config/router/navigation-guards/i18n.js +13 -0
  24. package/config/router/navigation-guards/index.js +3 -1
  25. package/config/router/navigation-guards/load-initial-settings.js +1 -1
  26. package/config/router/navigation-guards/runtime-extension-route.js +31 -0
  27. package/config/router/routes.js +10 -1
  28. package/config/uiplugins.js +130 -61
  29. package/core/plugin.ts +5 -0
  30. package/core/plugins.js +7 -1
  31. package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +42 -0
  32. package/detail/provisioning.cattle.io.cluster.vue +4 -4
  33. package/dialog/DeactivateDriverDialog.vue +30 -11
  34. package/edit/auth/__tests__/oidc.test.ts +2 -2
  35. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +86 -13
  36. package/edit/provisioning.cattle.io.cluster/__tests__/DirectoryConfig.test.ts +3 -134
  37. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +209 -0
  38. package/edit/provisioning.cattle.io.cluster/index.vue +8 -4
  39. package/edit/provisioning.cattle.io.cluster/rke2.vue +115 -17
  40. package/edit/provisioning.cattle.io.cluster/tabs/AddOnAdditionalManifest.vue +50 -0
  41. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +29 -64
  42. package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +42 -3
  43. package/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig.vue +22 -86
  44. package/edit/provisioning.cattle.io.cluster/tabs/registries/RegistryConfigs.vue +8 -2
  45. package/edit/provisioning.cattle.io.cluster/tabs/registries/__tests__/RegistryConfigs.test.ts +61 -0
  46. package/edit/token.vue +2 -1
  47. package/initialize/entry-helpers.js +4 -24
  48. package/list/management.cattle.io.feature.vue +4 -2
  49. package/middleware/authenticated.js +0 -19
  50. package/mixins/__tests__/chart.test.ts +4 -1
  51. package/mixins/auth-config.js +1 -1
  52. package/mixins/chart.js +30 -14
  53. package/models/__tests__/apps.deployment.test.ts +93 -0
  54. package/models/apps.deployment.js +18 -4
  55. package/models/driver.js +3 -2
  56. package/models/kontainerdriver.js +30 -13
  57. package/models/management.cattle.io.authconfig.js +2 -2
  58. package/models/management.cattle.io.cluster.js +2 -2
  59. package/models/management.cattle.io.user.js +3 -3
  60. package/models/nodedriver.js +35 -13
  61. package/models/provisioning.cattle.io.cluster.js +4 -0
  62. package/package.json +3 -2
  63. package/pages/404.vue +15 -0
  64. package/pages/auth/login.vue +4 -1
  65. package/pages/auth/setup.vue +4 -1
  66. package/pages/c/_cluster/apps/charts/install.vue +3 -2
  67. package/pages/c/_cluster/explorer/index.vue +5 -0
  68. package/pages/c/_cluster/manager/drivers/kontainerDriver/index.vue +0 -3
  69. package/pages/c/_cluster/manager/drivers/nodeDriver/index.vue +1 -4
  70. package/pages/c/_cluster/manager/jwt.authentication/index.vue +10 -4
  71. package/pages/c/_cluster/settings/performance.vue +2 -2
  72. package/pages/c/_cluster/uiplugins/InstallDialog.vue +2 -1
  73. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +7 -10
  74. package/pages/c/_cluster/uiplugins/index.vue +24 -16
  75. package/pages/home.vue +1 -13
  76. package/plugins/dashboard-store/actions.js +1 -1
  77. package/plugins/dashboard-store/getters.js +1 -1
  78. package/plugins/steve/__tests__/getters.test.ts +5 -5
  79. package/plugins/steve/getters.js +6 -4
  80. package/plugins/steve/hybrid-class.js +1 -5
  81. package/promptRemove/pod.vue +15 -7
  82. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +1 -1
  83. package/scripts/publish-shell.sh +54 -55
  84. package/scripts/test-plugins-build.sh +45 -39
  85. package/shell/types/shell/index.d.ts +2 -0
  86. package/store/auth.js +1 -1
  87. package/store/index.js +1 -1
  88. package/store/type-map.js +4 -2
  89. package/types/store/pagination.types.ts +1 -1
  90. package/utils/__tests__/kontainer.test.ts +89 -1
  91. package/utils/auth.js +1 -1
  92. package/utils/cluster.js +9 -0
  93. package/utils/kontainer.ts +5 -1
  94. package/utils/settings.ts +3 -1
  95. package/utils/version.js +2 -1
  96. package/creators/app/app.package.json +0 -13
  97. package/creators/app/files/.eslintignore +0 -16
  98. package/creators/app/files/.eslintrc.js +0 -173
  99. package/creators/app/files/.gitignore +0 -70
  100. package/creators/app/files/.gitlab-ci.yml +0 -14
  101. package/creators/app/files/.vscode/settings.json +0 -21
  102. package/creators/app/files/babel.config.js +0 -1
  103. package/creators/app/files/tsconfig.json +0 -42
  104. package/creators/app/files/vue.config.js +0 -6
  105. package/creators/app/init +0 -120
  106. package/creators/app/package.json +0 -25
  107. package/creators/pkg/files/.github/workflows/build-extension-catalog.yml +0 -24
  108. package/creators/pkg/files/.github/workflows/build-extension-charts.yml +0 -22
  109. package/creators/pkg/files/babel.config.js +0 -1
  110. package/creators/pkg/files/index.ts +0 -14
  111. package/creators/pkg/files/tsconfig.json +0 -53
  112. package/creators/pkg/files/vue.config.js +0 -1
  113. package/creators/pkg/init +0 -286
  114. package/creators/pkg/package.json +0 -19
  115. package/creators/pkg/pkg.package.json +0 -21
  116. package/creators/pkg/vue-shim.ts +0 -4
  117. package/creators/update/init +0 -56
  118. package/creators/update/package.json +0 -20
  119. package/creators/update/upgrade +0 -56
  120. package/rancher-components/components/Accordion/Accordion.test.ts +0 -45
  121. package/rancher-components/components/Accordion/Accordion.vue +0 -86
  122. package/rancher-components/components/Accordion/index.ts +0 -1
  123. package/rancher-components/components/BadgeState/BadgeState.test.ts +0 -12
  124. package/rancher-components/components/BadgeState/BadgeState.vue +0 -111
  125. package/rancher-components/components/BadgeState/index.ts +0 -1
  126. package/rancher-components/components/Banner/Banner.test.ts +0 -59
  127. package/rancher-components/components/Banner/Banner.vue +0 -244
  128. package/rancher-components/components/Banner/index.ts +0 -1
  129. package/rancher-components/components/Card/Card.test.ts +0 -37
  130. package/rancher-components/components/Card/Card.vue +0 -167
  131. package/rancher-components/components/Card/index.ts +0 -1
  132. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -68
  133. package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -421
  134. package/rancher-components/components/Form/Checkbox/index.ts +0 -1
  135. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -40
  136. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -402
  137. package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
  138. package/rancher-components/components/Form/Radio/RadioButton.test.ts +0 -33
  139. package/rancher-components/components/Form/Radio/RadioButton.vue +0 -293
  140. package/rancher-components/components/Form/Radio/RadioGroup.test.ts +0 -30
  141. package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -259
  142. package/rancher-components/components/Form/Radio/index.ts +0 -2
  143. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -172
  144. package/rancher-components/components/Form/TextArea/index.ts +0 -1
  145. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -94
  146. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -152
  147. package/rancher-components/components/Form/ToggleSwitch/index.ts +0 -1
  148. package/rancher-components/components/Form/index.ts +0 -5
  149. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -156
  150. package/rancher-components/components/LabeledTooltip/index.ts +0 -1
  151. package/rancher-components/components/StringList/StringList.test.ts +0 -754
  152. package/rancher-components/components/StringList/StringList.vue +0 -650
  153. package/rancher-components/components/StringList/index.ts +0 -1
  154. package/types/shell/index.d.ts +0 -4585
@@ -1,111 +0,0 @@
1
- <script lang="ts">
2
- import { PropType, defineComponent } from 'vue';
3
-
4
- interface Badge {
5
- stateBackground: string;
6
- stateDisplay: string;
7
- }
8
-
9
- /**
10
- * Badge state component.
11
- * <p>Represents a badge whose label and color is either taken from the value property or
12
- * from the label and color properties. The state property takes precedence.</p>
13
- */
14
- export default defineComponent({
15
- props: {
16
- /**
17
- * A value having the properties `stateBackground` and `stateDisplay`
18
- */
19
- value: {
20
- type: Object as PropType<Badge>,
21
- default: null
22
- },
23
-
24
- /**
25
- * Badge color. `stateBackground` of the value property takes precedence if supplied
26
- */
27
- color: {
28
- type: String,
29
- default: null
30
- },
31
-
32
- /**
33
- * Optional icon to be shown before the label
34
- */
35
- icon: {
36
- type: String,
37
- default: null
38
- },
39
-
40
- /**
41
- * Label to display in the badge. `stateDisplay` of the value property takes precedence if supplied
42
- */
43
- label: {
44
- type: String,
45
- default: null
46
- }
47
- },
48
-
49
- computed: {
50
- bg(): string | null {
51
- return this.value?.stateBackground || this.color;
52
- },
53
-
54
- msg(): string | null {
55
- return this.value?.stateDisplay || this.label;
56
- }
57
- }
58
- });
59
- </script>
60
-
61
- <template>
62
- <span :class="['badge-state', bg]">
63
- <i
64
- v-if="icon"
65
- class="icon"
66
- :class="{[icon]: true, 'mr-5': !!msg}"
67
- />{{ msg }}
68
- </span>
69
- </template>
70
-
71
- <style lang="scss" scoped>
72
- .badge-state {
73
- align-items: center;
74
- display: inline-flex;
75
- padding: 2px 10px;
76
- border: 1px solid transparent;
77
- border-radius: 20px;
78
-
79
- &.bg-info {
80
- border-color: var(--primary);
81
- }
82
-
83
- &.bg-error {
84
- border-color: var(--error);
85
- }
86
-
87
- &.bg-warning {
88
- border-color: var(--warning);
89
- }
90
-
91
- // Successful states are de-emphasized by using [text-]color instead of background-color
92
- &.bg-success {
93
- color: var(--success);
94
- background: transparent;
95
- border-color: var(--success);
96
- }
97
- }
98
- </style>
99
- <style lang="scss">
100
- // TODO: #6005
101
- // Investigate why this is here.. I don't think that styles for sortable table should belong here
102
- .sortable-table TD .badge-state {
103
- @include clip;
104
- display: inline-block;
105
- max-width: 100%;
106
- position: relative;
107
- max-width: 110px;
108
- font-size: .85em;
109
- vertical-align: middle;
110
- }
111
- </style>
@@ -1 +0,0 @@
1
- export { default as BadgeState } from './BadgeState.vue';
@@ -1,59 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { Banner } from './index';
3
-
4
- describe('component: Banner', () => {
5
- it('should display text based on label', () => {
6
- const label = 'test';
7
- const wrapper = mount(
8
- Banner,
9
- { propsData: { label } });
10
-
11
- const element = wrapper.find('span').element;
12
-
13
- expect(element.textContent).toBe(label);
14
- });
15
-
16
- it('should display an icon', () => {
17
- const icon = 'my-icon';
18
- const wrapper = mount(Banner, { propsData: { icon } });
19
-
20
- const element = wrapper.find(`.${ icon }`).element;
21
-
22
- expect(element.classList).toContain(icon);
23
- });
24
-
25
- it('should not display an icon', () => {
26
- const wrapper = mount(Banner);
27
-
28
- const element = wrapper.find(`[data-testid="banner-icon"]`).element;
29
-
30
- expect(element).not.toBeDefined();
31
- });
32
-
33
- it('should emit close event', () => {
34
- const wrapper = mount(Banner, { propsData: { closable: true } });
35
- const element = wrapper.find(`[data-testid="banner-close"]`).element;
36
-
37
- element.click();
38
-
39
- expect(wrapper.emitted('close')).toHaveLength(1);
40
- });
41
-
42
- it('should add the right color', () => {
43
- const color = 'red';
44
- const wrapper = mount(Banner, { propsData: { color } });
45
-
46
- const element = wrapper.element;
47
-
48
- expect(element.classList).toContain(color);
49
- });
50
-
51
- it('should stack the banner messages', () => {
52
- const stacked = true;
53
- const wrapper = mount(Banner, { propsData: { stacked } });
54
-
55
- const element = wrapper.find(`[data-testid="banner-content"]`).element;
56
-
57
- expect(element.classList).toContain('stacked');
58
- });
59
- });
@@ -1,244 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue';
3
- import { nlToBr } from '@shell/utils/string';
4
- import { stringify } from '@shell/utils/error';
5
-
6
- export default defineComponent({
7
- props: {
8
- /**
9
- * A color class that represents the color of the banner.
10
- * @values primary, secondary, success, warning, error, info
11
- */
12
- color: {
13
- type: String,
14
- default: 'secondary'
15
- },
16
- /**
17
- * The label to display as the banner's default content.
18
- */
19
- label: {
20
- type: [String, Error, Object],
21
- default: null
22
- },
23
- /**
24
- * The i18n key for the label to display as the banner's default content.
25
- */
26
- labelKey: {
27
- type: String,
28
- default: null
29
- },
30
- /**
31
- * Add icon for the banner
32
- */
33
- icon: {
34
- type: String,
35
- default: null
36
- },
37
- /**
38
- * Toggles the banner's close button.
39
- */
40
- closable: {
41
- type: Boolean,
42
- default: false
43
- },
44
- /**
45
- * Toggles the stacked class for the banner.
46
- */
47
- stacked: {
48
- type: Boolean,
49
- default: false
50
- }
51
- },
52
- computed: {
53
- /**
54
- * Return message text as label.
55
- */
56
- messageLabel(): string | void {
57
- return !(typeof this.label === 'string') ? stringify(this.label) : undefined;
58
- }
59
- },
60
- methods: { nlToBr }
61
- });
62
- </script>
63
- <template>
64
- <div
65
- class="banner"
66
- :class="{
67
- [color]: true,
68
- }"
69
- >
70
- <div
71
- v-if="icon"
72
- class="banner__icon"
73
- data-testid="banner-icon"
74
- >
75
- <i
76
- class="icon icon-2x"
77
- :class="icon"
78
- />
79
- </div>
80
- <div
81
- class="banner__content"
82
- data-testid="banner-content"
83
- :class="{
84
- closable,
85
- stacked,
86
- icon
87
- }"
88
- >
89
- <slot>
90
- <t
91
- v-if="labelKey"
92
- :k="labelKey"
93
- :raw="true"
94
- />
95
- <span v-else-if="messageLabel">{{ messageLabel }}</span>
96
- <span
97
- v-else
98
- v-clean-html="nlToBr(label)"
99
- />
100
- </slot>
101
- <div
102
- v-if="closable"
103
- class="banner__content__closer"
104
- @click="$emit('close')"
105
- >
106
- <i
107
- data-testid="banner-close"
108
- class="icon icon-close closer-icon"
109
- />
110
- </div>
111
- </div>
112
- </div>
113
- </template>
114
-
115
- <style lang="scss" scoped>
116
- $left-border-size: 4px;
117
- $icon-size: 24px;
118
-
119
- .banner {
120
- display: flex;
121
- margin: 15px 0;
122
- position: relative;
123
- width: 100%;
124
- color: var(--body-text);
125
-
126
- &__icon {
127
- width: $icon-size * 2;
128
- flex-grow: 1;
129
- display: flex;
130
- justify-content: center;
131
- align-items: center;
132
- box-sizing: content-box;
133
-
134
- .primary & {
135
- background: var(--primary);
136
- }
137
-
138
- .secondary & {
139
- background: var(--default);
140
- }
141
-
142
- .success & {
143
- background: var(--success);
144
- }
145
-
146
- .info & {
147
- background: var(--info);
148
- }
149
-
150
- .warning & {
151
- background: var(--warning);
152
- }
153
-
154
- .error & {
155
- background: var(--error);
156
- color: var(--primary-text);
157
- }
158
- }
159
-
160
- &__content {
161
- padding: 10px;
162
- transition: all 0.2s ease;
163
- line-height: 20px;
164
- width: 100%;
165
- border-left: solid $left-border-size transparent;
166
- display: flex;
167
- gap: 3px;
168
-
169
- .primary & {
170
- background: var(--primary);
171
- border-color: var(--primary);
172
- }
173
-
174
- .secondary & {
175
- background: var(--default-banner-bg);
176
- border-color: var(--default);
177
- }
178
-
179
- .success & {
180
- background: var(--success-banner-bg);
181
- border-color: var(--success);
182
- }
183
-
184
- .info & {
185
- background: var(--info-banner-bg);
186
- border-color: var(--info);
187
- }
188
-
189
- .warning & {
190
- background: var(--warning-banner-bg);
191
- border-color: var(--warning);
192
- }
193
-
194
- .error & {
195
- background: var(--error-banner-bg);
196
- border-color: var(--error);
197
- color: var(--error);
198
- }
199
-
200
- &.stacked {
201
- padding: 0 10px;
202
- margin: 0;
203
- transition: none;
204
- &:first-child {
205
- padding-top: 10px;
206
- }
207
- &:last-child {
208
- padding-bottom: 10px;
209
- }
210
- }
211
-
212
- &.closable {
213
- padding-right: $icon-size * 2;
214
- }
215
-
216
- &__closer {
217
- display: flex;
218
- align-items: center;
219
-
220
- cursor: pointer;
221
- position: absolute;
222
- top: 0;
223
- right: 0;
224
- bottom: 0;
225
- width: $icon-size;
226
- line-height: $icon-size;
227
- text-align: center;
228
-
229
- .closer-icon {
230
- opacity: 0.7;
231
-
232
- &:hover {
233
- opacity: 1;
234
- color: var(--link);
235
- }
236
- }
237
- }
238
-
239
- &.icon {
240
- border-left: none;
241
- }
242
- }
243
- }
244
- </style>
@@ -1 +0,0 @@
1
- export { default as Banner } from './Banner.vue';
@@ -1,37 +0,0 @@
1
- import { mount } from '@vue/test-utils';
2
- import { Card } from './index';
3
-
4
- describe('component: Card', () => {
5
- const title = 'Card title';
6
- const body = 'Card body';
7
-
8
- it('should have a card title', () => {
9
- const wrapper = mount(Card, {
10
- propsData: { title },
11
- slots: { title: '<div>Card title</div>' }
12
- });
13
-
14
- const element = wrapper.find('[data-testid="card-title-slot"]');
15
-
16
- expect(element.exists()).toBe(true);
17
- expect(element.text()).toBe(title);
18
- });
19
-
20
- it('should have a card body', () => {
21
- const wrapper = mount(Card, {
22
- propsData: { body },
23
- slots: { body: '<div>Card body</div>' }
24
- });
25
- const element = wrapper.find('[data-testid="card-body-slot"]');
26
-
27
- expect(element.exists()).toBe(true);
28
- expect(element.text()).toBe(body);
29
- });
30
-
31
- it('should display the default card actions', () => {
32
- const wrapper = mount(Card);
33
- const element = wrapper.find('[data-testid="card-actions-slot"]');
34
-
35
- expect(element.exists()).toBe(true);
36
- });
37
- });
@@ -1,167 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent, PropType } from 'vue';
3
-
4
- export default defineComponent({
5
- name: 'Card',
6
- props: {
7
- /**
8
- * The card's title.
9
- */
10
- title: {
11
- type: String,
12
- default: ''
13
- },
14
- /**
15
- * The text content for the card's body.
16
- */
17
- content: {
18
- type: String,
19
- default: ''
20
- },
21
- /**
22
- * The function to invoke when the default action button is clicked.
23
- */
24
- buttonAction: {
25
- type: Function as PropType<(event: MouseEvent) => void>,
26
- default: (): void => { }
27
- },
28
- /**
29
- * The text for the default action button.
30
- */
31
- buttonText: {
32
- type: String,
33
- default: 'go'
34
- },
35
- /**
36
- * Toggles the card's highlight-border class.
37
- */
38
- showHighlightBorder: {
39
- type: Boolean,
40
- default: true
41
- },
42
- /**
43
- * Toggles the card's Actions section.
44
- */
45
- showActions: {
46
- type: Boolean,
47
- default: true
48
- },
49
- sticky: {
50
- type: Boolean,
51
- default: false,
52
- },
53
- }
54
- });
55
- </script>
56
-
57
- <template>
58
- <div
59
- class="card-container"
60
- :class="{'highlight-border': showHighlightBorder, 'card-sticky': sticky}"
61
- data-testid="card"
62
- >
63
- <div class="card-wrap">
64
- <div
65
- class="card-title"
66
- data-testid="card-title-slot"
67
- >
68
- <slot name="title">
69
- {{ title }}
70
- </slot>
71
- </div>
72
- <hr>
73
- <div
74
- class="card-body"
75
- data-testid="card-body-slot"
76
- >
77
- <slot name="body">
78
- {{ content }}
79
- </slot>
80
- </div>
81
- <div
82
- v-if="showActions"
83
- class="card-actions"
84
- data-testid="card-actions-slot"
85
- >
86
- <slot name="actions">
87
- <button
88
- class="btn role-primary"
89
- @click="buttonAction"
90
- >
91
- {{ buttonText }}
92
- </button>
93
- </slot>
94
- </div>
95
- </div>
96
- </div>
97
- </template>
98
-
99
- <style lang='scss'>
100
- .card-container {
101
- &.highlight-border {
102
- border-left: 5px solid var(--primary);
103
- }
104
- border-radius: var(--border-radius);
105
- display: flex;
106
- flex-basis: 40%;
107
- margin: 10px;
108
- min-height: 100px;
109
- padding: 10px;
110
- box-shadow: 0 0 20px var(--shadow);
111
- &:not(.top) {
112
- align-items: top;
113
- flex-direction: row;
114
- justify-content: start;
115
- }
116
- .card-wrap {
117
- width: 100%;
118
- }
119
- & .card-body {
120
- color: var(--input-label);
121
- display: flex;
122
- flex-direction: column;
123
- justify-content: center;
124
- }
125
- & .card-actions {
126
- align-self: end;
127
- display: flex;
128
- padding-top: 20px;
129
- }
130
- & .card-title {
131
- align-items: center;
132
- display: flex;
133
- width: 100%;
134
- h5 {
135
- margin: 0;
136
- }
137
- .flex-right {
138
- margin-left: auto;
139
- }
140
- }
141
-
142
- // Sticky mode will stick header and footer to top and bottom with content in the middle scrolling
143
- &.card-sticky {
144
- // display: flex;
145
- // flex-direction: column;
146
- overflow: hidden;
147
-
148
- .card-wrap {
149
- display: flex;
150
- flex-direction: column;
151
-
152
- .card-body {
153
- justify-content: flex-start;
154
- overflow: auto;
155
- }
156
-
157
- > * {
158
- flex: 0;
159
- }
160
-
161
- .card-body {
162
- flex: 1;
163
- }
164
- }
165
- }
166
- }
167
- </style>
@@ -1 +0,0 @@
1
- export { default as Card } from './Card.vue';
@@ -1,68 +0,0 @@
1
- import { shallowMount, Wrapper } from '@vue/test-utils';
2
- import { Checkbox } from './index';
3
-
4
- describe('checkbox.vue', () => {
5
- const event = {
6
- target: { tagName: 'input', href: null },
7
- stopPropagation: () => { },
8
- preventDefault: () => { }
9
- } as unknown as MouseEvent;
10
-
11
- it('is unchecked by default', () => {
12
- const wrapper = shallowMount(Checkbox);
13
- const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
14
-
15
- expect(cbInput.checked).toBe(false);
16
- });
17
-
18
- it('renders a true value', () => {
19
- const wrapper = shallowMount(Checkbox, { propsData: { value: true } });
20
- const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
21
-
22
- expect(cbInput.checked).toBe(true);
23
- });
24
-
25
- it('updates from false to true when props change', async() => {
26
- const wrapper = shallowMount(Checkbox);
27
- const cbInput = wrapper.find('input[type="checkbox"]').element as HTMLInputElement;
28
-
29
- expect(cbInput.checked).toBe(false);
30
-
31
- await wrapper.setProps({ value: true });
32
-
33
- expect(cbInput.checked).toBe(true);
34
- });
35
-
36
- it('emits an input event with a true value', async() => {
37
- const wrapper: Wrapper<InstanceType<typeof Checkbox>> = shallowMount(Checkbox);
38
-
39
- wrapper.vm.clicked(event);
40
- await wrapper.vm.$nextTick();
41
-
42
- expect(wrapper.emitted().input?.length).toBe(1);
43
- expect(wrapper.emitted().input?.[0][0]).toBe(true);
44
- });
45
-
46
- it('emits an input event with a custom valueWhenTrue', async() => {
47
- const valueWhenTrue = 'BIG IF TRUE';
48
-
49
- const wrapper: Wrapper<InstanceType<typeof Checkbox>> = shallowMount(Checkbox, { propsData: { value: false, valueWhenTrue } });
50
-
51
- wrapper.vm.clicked(event);
52
- await wrapper.vm.$nextTick();
53
-
54
- expect(wrapper.emitted().input?.length).toBe(1);
55
- expect(wrapper.emitted().input?.[0][0]).toBe(valueWhenTrue);
56
- });
57
-
58
- it('updates from valueWhenTrue to falsy', async() => {
59
- const valueWhenTrue = 'REAL HUGE IF FALSE';
60
-
61
- const wrapper: Wrapper<InstanceType<typeof Checkbox>> = shallowMount(Checkbox, { propsData: { value: valueWhenTrue, valueWhenTrue } });
62
-
63
- wrapper.vm.clicked(event);
64
- await wrapper.vm.$nextTick();
65
-
66
- expect(wrapper.emitted().input?.[0][0]).toBeNull();
67
- });
68
- });