@rancher/shell 3.0.0-rc.1 → 3.0.0-rc.3

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 (123) hide show
  1. package/assets/styles/base/_variables.scss +1 -0
  2. package/assets/styles/global/_layout.scss +12 -3
  3. package/assets/styles/global/_select.scss +1 -1
  4. package/assets/styles/global/_tooltip.scss +47 -69
  5. package/assets/translations/en-us.yaml +1 -0
  6. package/components/ActionDropdown.vue +10 -14
  7. package/components/ActionMenu.vue +1 -1
  8. package/components/ButtonDropdown.vue +9 -8
  9. package/components/CodeMirror.vue +82 -67
  10. package/components/CruResource.vue +61 -61
  11. package/components/Import.vue +0 -1
  12. package/components/InputOrDisplay.vue +21 -33
  13. package/components/LocaleSelector.vue +5 -3
  14. package/components/Questions/__tests__/Boolean.test.ts +1 -2
  15. package/components/Questions/__tests__/Float.test.ts +1 -2
  16. package/components/Questions/__tests__/Int.test.ts +1 -2
  17. package/components/Questions/__tests__/String.test.ts +1 -2
  18. package/components/Questions/__tests__/Yaml.test.ts +1 -1
  19. package/components/Questions/__tests__/utils/questions-defaults.ts +2 -2
  20. package/components/SideNav.vue +3 -3
  21. package/components/SortableTable/index.vue +2 -1
  22. package/components/Wizard.vue +2 -0
  23. package/components/YamlEditor.vue +1 -1
  24. package/components/__tests__/CodeMirror.test.ts +91 -94
  25. package/components/__tests__/ConsumptionGauge.test.ts +2 -2
  26. package/components/__tests__/ContainerResourceLimit.test.ts +35 -0
  27. package/components/__tests__/NamespaceFilter.test.ts +10 -7
  28. package/components/auth/AllowedPrincipals.vue +2 -2
  29. package/components/auth/RoleDetailEdit.vue +13 -17
  30. package/components/auth/SelectPrincipal.vue +2 -2
  31. package/components/fleet/FleetStatus.vue +15 -16
  32. package/components/form/ArrayList.vue +1 -1
  33. package/components/form/ArrayListGrouped.vue +18 -5
  34. package/components/form/LabeledSelect.vue +16 -11
  35. package/components/form/Labels.vue +11 -13
  36. package/components/form/Select.vue +17 -1
  37. package/components/form/UnitInput.vue +2 -0
  38. package/components/form/__tests__/Command.test.ts +6 -5
  39. package/components/form/__tests__/Taints.test.ts +9 -9
  40. package/components/form/__tests__/UnitInput.test.ts +68 -0
  41. package/components/formatter/AppSummaryGraph.vue +3 -3
  42. package/components/formatter/FleetSummaryGraph.vue +3 -3
  43. package/components/formatter/InternalExternalIP.vue +13 -15
  44. package/components/formatter/MachineSummaryGraph.vue +3 -3
  45. package/components/formatter/Scale.vue +3 -3
  46. package/components/formatter/Weight.vue +3 -3
  47. package/components/nav/Header.vue +31 -14
  48. package/components/nav/NamespaceFilter.vue +3 -2
  49. package/components/nav/TopLevelMenu.vue +11 -10
  50. package/components/nav/WindowManager/ContainerLogs.vue +3 -2
  51. package/components/nav/WindowManager/ContainerShell.vue +7 -2
  52. package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +195 -192
  53. package/components/nav/WindowManager/__tests__/ContainerShell.test.ts +23 -19
  54. package/composables/useUserRetentionValidation.test.ts +1 -1
  55. package/composables/useUserRetentionValidation.ts +1 -1
  56. package/core/{plugin-helpers.js → plugin-helpers.ts} +25 -7
  57. package/core/plugin-routes.ts +41 -29
  58. package/core/plugin.ts +30 -3
  59. package/core/plugins-loader.js +2 -0
  60. package/detail/__tests__/autoscaling.horizontalpodautoscaler.test.ts +16 -8
  61. package/detail/helm.cattle.io.projecthelmchart.vue +32 -35
  62. package/edit/__tests__/namespace.test.ts +7 -9
  63. package/edit/__tests__/service.test.ts +14 -2
  64. package/edit/auth/__tests__/azuread.test.ts +10 -11
  65. package/edit/auth/azuread.vue +1 -1
  66. package/edit/auth/ldap/config.vue +280 -280
  67. package/edit/auth/saml.vue +1 -4
  68. package/edit/cis.cattle.io.clusterscan.vue +80 -82
  69. package/edit/cis.cattle.io.clusterscanprofile.vue +29 -31
  70. package/edit/fleet.cattle.io.clustergroup.vue +3 -3
  71. package/edit/management.cattle.io.clusterroletemplatebinding.vue +1 -0
  72. package/edit/management.cattle.io.fleetworkspace.vue +3 -3
  73. package/edit/management.cattle.io.node.vue +3 -2
  74. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +3 -2
  75. package/edit/namespace.vue +3 -1
  76. package/edit/networking.k8s.io.ingress/index.vue +3 -2
  77. package/edit/networking.k8s.io.networkpolicy/index.vue +2 -2
  78. package/edit/node.vue +3 -3
  79. package/edit/persistentvolume/__tests__/persistentvolume.test.ts +9 -4
  80. package/edit/persistentvolume/index.vue +3 -3
  81. package/edit/persistentvolumeclaim.vue +3 -3
  82. package/edit/policy.poddisruptionbudget.vue +3 -3
  83. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +5 -6
  84. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +13 -6
  85. package/edit/provisioning.cattle.io.cluster/rke2.vue +7 -1
  86. package/edit/provisioning.cattle.io.cluster/tabs/registries/__tests__/RegistryConfigs.test.ts +6 -7
  87. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +30 -32
  88. package/edit/resources.cattle.io.backup.vue +95 -97
  89. package/edit/resources.cattle.io.restore.vue +96 -98
  90. package/edit/service.vue +12 -4
  91. package/edit/serviceaccount.vue +3 -3
  92. package/edit/storage.k8s.io.storageclass/index.vue +3 -3
  93. package/edit/workload/Job.vue +2 -2
  94. package/edit/workload/__tests__/Job.test.ts +5 -5
  95. package/edit/workload/__tests__/index.test.ts +9 -7
  96. package/edit/workload/index.vue +17 -11
  97. package/edit/workload/storage/Mount.vue +7 -4
  98. package/edit/workload/storage/__tests__/Mount.test.ts +6 -2
  99. package/edit/workload/storage/index.vue +10 -23
  100. package/initialize/entry-helpers.js +0 -5
  101. package/initialize/install-plugins.js +2 -2
  102. package/mixins/fetch.client.js +2 -1
  103. package/mixins/page-actions.js +1 -1
  104. package/package.json +3 -3
  105. package/pages/auth/login.vue +2 -1
  106. package/pages/c/_cluster/auth/user.retention/index.vue +1 -1
  107. package/pages/c/_cluster/istio/index.vue +2 -2
  108. package/pages/c/_cluster/longhorn/__tests__/longhorn.index.test.ts +3 -2
  109. package/pages/c/_cluster/monitoring/index.vue +1 -1
  110. package/pages/c/_cluster/uiplugins/AddExtensionRepos.vue +34 -36
  111. package/pages/c/_cluster/uiplugins/__tests__/AddExtensionRepos.test.ts +7 -29
  112. package/pages/index.vue +10 -2
  113. package/plugins/i18n.js +1 -1
  114. package/promptRemove/management.cattle.io.roletemplate.vue +3 -5
  115. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +4 -32
  116. package/store/type-map.js +3 -2
  117. package/vue.config.js +409 -391
  118. package/composables/useStore.ts +0 -16
  119. package/plugins/clean-html-directive.js +0 -10
  120. package/plugins/clean-tooltip-directive.js +0 -9
  121. package/plugins/int-number.js +0 -9
  122. package/plugins/positive-int-number.js +0 -9
  123. package/plugins/trim-whitespace.js +0 -10
@@ -587,75 +587,74 @@ export default {
587
587
  </template>
588
588
  </template>
589
589
  <template #controlsContainer="{showPrevious, next, back, activeStep, canNext, activeStepIndex, visibleSteps}">
590
- <template name="form-footer">
591
- <CruResourceFooter
592
- class="cru__footer"
593
- :mode="mode"
594
- :is-form="showAsForm"
595
- :show-cancel="showCancel"
596
- @cancel-confirmed="confirmCancel"
590
+ <CruResourceFooter
591
+ class="cru__footer"
592
+ :mode="mode"
593
+ :is-form="showAsForm"
594
+ :show-cancel="showCancel"
595
+ @cancel-confirmed="confirmCancel"
596
+ >
597
+ <!-- Pass down templates provided by the caller -->
598
+ <template
599
+ v-for="(_, slot) of $slots"
600
+ #[slot]="scope"
601
+ :key="slot"
597
602
  >
598
- <!-- Pass down templates provided by the caller -->
603
+ <template v-if="shouldProvideSlot(slot)">
604
+ <slot
605
+ :name="slot"
606
+ v-bind="scope"
607
+ />
608
+ </template>
609
+ </template>
610
+ <div class="controls-steps">
611
+ <button
612
+ v-if="showYaml"
613
+ type="button"
614
+ class="btn role-secondary"
615
+ @click="showPreviewYaml"
616
+ >
617
+ <t k="cruResource.previewYaml" />
618
+ </button>
599
619
  <template
600
- v-for="(_, slot) of $slots"
601
- :key="slot"
620
+ v-if="showPrevious"
621
+ name="back"
602
622
  >
603
- <template v-if="shouldProvideSlot(slot)">
604
- <slot
605
- :name="slot"
606
- v-bind="{ ...$slots[slot]() }"
607
- />
608
- </template>
609
- </template>
610
- <div class="controls-steps">
611
623
  <button
612
- v-if="showYaml"
613
624
  type="button"
614
625
  class="btn role-secondary"
615
- @click="showPreviewYaml"
626
+ @click="back()"
616
627
  >
617
- <t k="cruResource.previewYaml" />
628
+ <t k="wizard.previous" />
618
629
  </button>
619
- <template
620
- v-if="showPrevious"
621
- name="back"
622
- >
623
- <button
624
- type="button"
625
- class="btn role-secondary"
626
- @click="back()"
627
- >
628
- <t k="wizard.previous" />
629
- </button>
630
- </template>
631
- <template
632
- v-if="activeStepIndex === visibleSteps.length-1"
633
- name="finish"
634
- >
635
- <AsyncButton
636
- v-if="!showSubtypeSelection && !isView"
637
- ref="save"
638
- :disabled="!activeStep.ready"
639
- :mode="finishButtonMode || mode"
640
- @click="$emit('finish', $event)"
641
- />
642
- </template>
643
- <template
644
- v-else
645
- name="next"
630
+ </template>
631
+ <template
632
+ v-if="activeStepIndex === visibleSteps.length-1"
633
+ name="finish"
634
+ >
635
+ <AsyncButton
636
+ v-if="!showSubtypeSelection && !isView"
637
+ ref="save"
638
+ :disabled="!activeStep.ready"
639
+ :mode="finishButtonMode || mode"
640
+ @click="$emit('finish', $event)"
641
+ />
642
+ </template>
643
+ <template
644
+ v-else
645
+ name="next"
646
+ >
647
+ <button
648
+ :disabled="!canNext"
649
+ type="button"
650
+ class="btn role-primary"
651
+ @click="next()"
646
652
  >
647
- <button
648
- :disabled="!canNext"
649
- type="button"
650
- class="btn role-primary"
651
- @click="next()"
652
- >
653
- <t k="wizard.next" />
654
- </button>
655
- </template>
656
- </div>
657
- </CruResourceFooter>
658
- </template>
653
+ <t k="wizard.next" />
654
+ </button>
655
+ </template>
656
+ </div>
657
+ </CruResourceFooter>
659
658
  </template>
660
659
  </Wizard>
661
660
  </div>
@@ -681,12 +680,13 @@ export default {
681
680
  <!-- Pass down templates provided by the caller -->
682
681
  <template
683
682
  v-for="(_, slot) of $slots"
683
+ #[slot]="scope"
684
684
  :key="slot"
685
685
  >
686
686
  <template v-if="shouldProvideSlot(slot)">
687
687
  <slot
688
688
  :name="slot"
689
- v-bind="{ ...$slots[slot]() }"
689
+ v-bind="scope"
690
690
  />
691
691
  </template>
692
692
  </template>
@@ -140,7 +140,6 @@ export default {
140
140
  <div class="col span-6">
141
141
  <LabeledSelect
142
142
  :value="defaultNamespace"
143
- class="pull-right"
144
143
  :options="namespaceOptions"
145
144
  label-key="import.defaultNamespace.label"
146
145
  mode="edit"
@@ -1,28 +1,9 @@
1
1
  <script>
2
- import { createApp } from 'vue';
2
+ import { h, computed } from 'vue';
3
3
  import { _VIEW } from '@shell/config/query-params';
4
- const vueApp = createApp({});
5
4
 
6
- const component = vueApp.component('InputOrDisplay', {
7
- render(h) {
8
- if (this.isView) {
9
- return h('div',
10
- { attrs: { class: 'label' } },
11
- [
12
- h('div',
13
- { attrs: { class: 'text-label' } },
14
- this.$slots.name ? this.$slots.name : this.name
15
- ),
16
- h('div',
17
- { attrs: { class: 'value' } },
18
- this.$slots.value ? this.$slots.value : this.displayValue
19
- )
20
- ]
21
- );
22
- } else {
23
- return this.$slots.default;
24
- }
25
- },
5
+ export default {
6
+ name: 'InputOrDisplay',
26
7
  props: {
27
8
  name: {
28
9
  type: String,
@@ -37,22 +18,29 @@ const component = vueApp.component('InputOrDisplay', {
37
18
  default: 'edit'
38
19
  }
39
20
  },
40
- computed: {
41
- isView() {
42
- return this.mode === _VIEW;
43
- },
21
+ setup(props, { slots }) {
22
+ const isView = computed(() => props.mode === _VIEW);
44
23
 
45
- displayValue() {
46
- if (Array.isArray(this.value) && this.value.length === 0) {
24
+ const displayValue = computed(() => {
25
+ if (Array.isArray(props.value) && props.value.length === 0) {
47
26
  return '';
48
27
  } else {
49
- return this.value;
28
+ return props.value;
50
29
  }
51
- }
52
- }
53
- });
30
+ });
54
31
 
55
- export default component;
32
+ return () => {
33
+ if (isView.value) {
34
+ return h('div', { class: 'label' }, [
35
+ h('div', { class: 'text-label' }, slots.name ? slots.name : props.name),
36
+ h('div', { class: 'value' }, slots.value ? slots.value : displayValue.value)
37
+ ]);
38
+ } else {
39
+ return slots.default;
40
+ }
41
+ };
42
+ }
43
+ };
56
44
  </script>
57
45
 
58
46
  <style lang="scss" scoped>
@@ -52,9 +52,11 @@ export default {
52
52
  <div v-if="mode === 'login'">
53
53
  <div v-if="showLocale">
54
54
  <v-dropdown
55
- popover-class="localeSelector"
55
+ popperClass="localeSelector"
56
56
  placement="top"
57
- trigger="click"
57
+ distance="8"
58
+ skidding="12"
59
+ :triggers="['click']"
58
60
  >
59
61
  <a
60
62
  data-testid="locale-selector"
@@ -63,7 +65,7 @@ export default {
63
65
  {{ selectedLocaleLabel }}
64
66
  <i class="icon icon-fw icon-sort-down" />
65
67
  </a>
66
- <template #popover>
68
+ <template #popper>
67
69
  <ul
68
70
  class="list-unstyled dropdown"
69
71
  style="margin: -1px;"
@@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils';
3
3
  import { _EDIT } from '@shell/config/query-params';
4
4
  import defaults from './utils/questions-defaults';
5
5
 
6
- describe.skip('(Vue3 Skip) the Boolean Component', () => {
6
+ describe('the Boolean Component', () => {
7
7
  it('input field is present', () => {
8
8
  const wrapper = mount(Questions, {
9
9
  props: {
@@ -25,7 +25,6 @@ describe.skip('(Vue3 Skip) the Boolean Component', () => {
25
25
 
26
26
  const inputFields = wrapper.findAll('[data-testid="boolean-input-var_name"] input[type=checkbox]');
27
27
 
28
- // TODO: UNIT TEST - Default stubs give us a tab stub, rendering no input fields
29
28
  expect(inputFields).toHaveLength(1);
30
29
 
31
30
  const descriptionFields = wrapper.findAll('[data-testid="boolean-description-var_name"]');
@@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils';
3
3
  import { _EDIT } from '@shell/config/query-params';
4
4
  import defaults from './utils/questions-defaults';
5
5
 
6
- describe.skip('(Vue3 Skip) the float Component', () => {
6
+ describe('the float Component', () => {
7
7
  it('input field is present', () => {
8
8
  const wrapper = mount(Questions, {
9
9
  props: {
@@ -25,7 +25,6 @@ describe.skip('(Vue3 Skip) the float Component', () => {
25
25
 
26
26
  const inputFields = wrapper.findAll('[data-testid="float-input-var_name"]');
27
27
 
28
- // TODO: UNIT TEST - Default stubs give us a tab stub, rendering no input fields
29
28
  expect(inputFields).toHaveLength(1);
30
29
 
31
30
  const descriptionFields = wrapper.findAll('[data-testid="float-description-var_name"]');
@@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils';
3
3
  import { _EDIT } from '@shell/config/query-params';
4
4
  import defaults from './utils/questions-defaults';
5
5
 
6
- describe.skip('(Vue3 Skip) the Int Component', () => {
6
+ describe('the Int Component', () => {
7
7
  it('input field is present', () => {
8
8
  const wrapper = mount(Questions, {
9
9
  props: {
@@ -25,7 +25,6 @@ describe.skip('(Vue3 Skip) the Int Component', () => {
25
25
 
26
26
  const inputFields = wrapper.findAll('[data-testid="int-input-var_name"]');
27
27
 
28
- // TODO: UNIT TEST - Default stubs give us a tab stub, rendering no input fields
29
28
  expect(inputFields).toHaveLength(1);
30
29
 
31
30
  const descriptionFields = wrapper.findAll('[data-testid="int-description-var_name"]');
@@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils';
3
3
  import { _EDIT } from '@shell/config/query-params';
4
4
  import defaults from './utils/questions-defaults';
5
5
 
6
- describe.skip('(Vue3 Skip) the String Component', () => {
6
+ describe('the String Component', () => {
7
7
  it('input field is present', () => {
8
8
  const wrapper = mount(Questions, {
9
9
  props: {
@@ -25,7 +25,6 @@ describe.skip('(Vue3 Skip) the String Component', () => {
25
25
 
26
26
  const inputFields = wrapper.findAll('[data-testid="string-input-var_name"]');
27
27
 
28
- // TODO: UNIT TEST - Default stubs give us a tab stub, rendering no input fields
29
28
  expect(inputFields).toHaveLength(1);
30
29
 
31
30
  const descriptionFields = wrapper.findAll('[data-testid="string-description-var_name"]');
@@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils';
3
3
  import { _EDIT } from '@shell/config/query-params';
4
4
  import defaults from './utils/questions-defaults';
5
5
 
6
- describe.skip('(Vue3 Skip) the yaml Component', () => {
6
+ describe('the yaml Component', () => {
7
7
  it('input field is present', () => {
8
8
  const wrapper = mount(Questions, {
9
9
  props: {
@@ -1,7 +1,7 @@
1
1
 
2
2
  const defaultStubs = {
3
- Tab: true,
4
- Tabbed: true,
3
+ Tab: { template: '<span><slot/></span>' },
4
+ Tabbed: false,
5
5
  };
6
6
  const defaultGetters = {
7
7
  currentStore: () => 'current_store',
@@ -439,9 +439,9 @@ export default {
439
439
  <!-- locale selector -->
440
440
  <span v-if="isSingleProduct">
441
441
  <v-dropdown
442
- popover-class="localeSelector"
442
+ popperClass="localeSelector"
443
443
  placement="top"
444
- trigger="click"
444
+ :triggers="['click']"
445
445
  >
446
446
  <a
447
447
  data-testid="locale-selector"
@@ -450,7 +450,7 @@ export default {
450
450
  {{ locale }}
451
451
  </a>
452
452
 
453
- <template #popover>
453
+ <template #popper>
454
454
  <ul
455
455
  class="list-unstyled dropdown"
456
456
  style="margin: -1px;"
@@ -1,5 +1,6 @@
1
1
  <script>
2
2
  import { mapGetters } from 'vuex';
3
+ import { defineAsyncComponent } from 'vue';
3
4
  import day from 'dayjs';
4
5
  import isEmpty from 'lodash/isEmpty';
5
6
  import { dasherize, ucFirst } from '@shell/utils/string';
@@ -682,7 +683,7 @@ export default {
682
683
  const pluginFormatter = this.$plugin?.getDynamic('formatters', c.formatter);
683
684
 
684
685
  if (pluginFormatter) {
685
- component = pluginFormatter;
686
+ component = defineAsyncComponent(pluginFormatter);
686
687
  needRef = true;
687
688
  }
688
689
  }
@@ -4,6 +4,7 @@ import AsyncButton from '@shell/components/AsyncButton';
4
4
  import { Banner } from '@components/Banner';
5
5
  import Loading from '@shell/components/Loading';
6
6
  import { stringify } from '@shell/utils/error';
7
+ import LazyImage from '@shell/components/LazyImage';
7
8
 
8
9
  /*
9
10
  Wizard accepts an array of steps (see props), and creates named slots for each step.
@@ -26,6 +27,7 @@ export default {
26
27
  AsyncButton,
27
28
  Banner,
28
29
  Loading,
30
+ LazyImage,
29
31
  },
30
32
 
31
33
  props: {
@@ -103,7 +103,7 @@ export default {
103
103
  mode: 'yaml',
104
104
  lint: !readOnly,
105
105
  lineNumbers: !readOnly,
106
- styleActiveLine: true,
106
+ styleActiveLine: false,
107
107
  tabSize: 2,
108
108
  indentWithTabs: false,
109
109
  cursorBlinkRate: ( readOnly ? -1 : 530 ),
@@ -1,96 +1,93 @@
1
- // import { nextTick } from 'vue';
2
- // import { shallowMount, Wrapper } from '@vue/test-utils';
3
- // import CodeMirror from '@shell/components/CodeMirror.vue';
4
- // import { _EDIT, _YAML } from '@shell/config/query-params';
5
-
6
- // // eslint-disable-next-line jest/no-disabled-tests
7
- // describe.skip('component: CodeMirror.vue', () => {
8
- // let wrapper: Wrapper<InstanceType<typeof CodeMirror>>;
9
-
10
- // const options = {
11
- // readOnly: false,
12
- // gutters: [
13
- // 'CodeMirror-lint-markers',
14
- // 'CodeMirror-foldgutter'
15
- // ],
16
- // mode: 'yaml',
17
- // lint: true,
18
- // lineNumbers: true,
19
- // styleActiveLine: true,
20
- // tabSize: 2,
21
- // indentWithTabs: false,
22
- // cursorBlinkRate: 530,
23
- // extraKeys: { 'Ctrl-Space': 'autocomplete' }
24
- // };
25
-
26
- // const mountOptions = {
27
- // propsData: {
28
- // value: '',
29
- // mode: _EDIT,
30
- // options,
31
- // asTextArea: false,
32
- // showKeyMapBox: true,
33
- // },
34
- // mocks: {
35
- // $store: {
36
- // getters: {
37
- // currentStore: () => 'current_store',
38
- // 'current_store/schemaFor': jest.fn(),
39
- // 'current_store/all': jest.fn(),
40
- // 'i18n/t': () => 'Vim',
41
- // 'prefs/get': () => 'Vim',
42
- // 'prefs/theme': jest.fn(),
43
- // }
44
- // },
45
- // $route: { query: { AS: _YAML } },
46
- // $router: { applyQuery: jest.fn() },
47
- // },
48
- // };
49
-
50
- // // eslint-disable-next-line jest/no-disabled-tests
51
- // describe.skip('keyMap info', () => {
52
- // (window as any).__codeMirrorLoader = () => new Promise((resolve) => {
53
- // resolve(true);
54
- // });
55
-
56
- // wrapper = shallowMount(
57
- // CodeMirror,
58
- // mountOptions,
59
- // );
60
-
61
- // it(`should show keyMap preference`, async() => {
62
- // await nextTick();
63
-
64
- // const keyMapBox = wrapper.find('[data-testid="code-mirror-keymap"]');
65
- // const keyboardIcon = keyMapBox.find('.keymap-indicator');
66
- // const closeIcon = keyMapBox.find('.icon-close');
67
-
68
- // expect(keyboardIcon.element).toBeDefined();
69
- // expect(closeIcon.element).toBeDefined();
70
- // });
71
-
72
- // it(`should remove keyMap box`, async() => {
73
- // await nextTick();
74
-
75
- // let keyMapBox = wrapper.find('[data-testid="code-mirror-keymap"]');
76
-
77
- // keyMapBox.trigger('mouseenter');
78
- // await nextTick();
79
-
80
- // const closeIcon = keyMapBox.find('.icon-close');
81
-
82
- // closeIcon.element.click();
83
- // await nextTick();
84
-
85
- // keyMapBox = wrapper.find('[data-testid="code-mirror-keymap"]');
86
-
87
- // expect(keyMapBox.element).toBeUndefined();
88
- // });
89
- // });
90
- // });
91
-
92
- describe.skip('(Vue3 Skip) it must have one test', () => {
93
- it('will pass', () => {
94
- expect(true).toBe(true);
1
+ import { nextTick } from 'vue';
2
+ import { shallowMount, Wrapper } from '@vue/test-utils';
3
+ import CodeMirror from '@shell/components/CodeMirror.vue';
4
+ import { _EDIT, _YAML } from '@shell/config/query-params';
5
+
6
+ // eslint-disable-next-line jest/no-disabled-tests
7
+ describe('component: CodeMirror.vue', () => {
8
+ let wrapper: Wrapper<InstanceType<typeof CodeMirror>>;
9
+
10
+ const options = {
11
+ readOnly: false,
12
+ gutters: [
13
+ 'CodeMirror-lint-markers',
14
+ 'CodeMirror-foldgutter'
15
+ ],
16
+ mode: 'yaml',
17
+ lint: true,
18
+ lineNumbers: true,
19
+ styleActiveLine: true,
20
+ tabSize: 2,
21
+ indentWithTabs: false,
22
+ cursorBlinkRate: 530,
23
+ extraKeys: { 'Ctrl-Space': 'autocomplete' }
24
+ };
25
+
26
+ const mountOptions = {
27
+ propsData: {
28
+ value: '',
29
+ mode: _EDIT,
30
+ options,
31
+ asTextArea: false,
32
+ showKeyMapBox: true,
33
+ },
34
+ global: {
35
+ mocks: {
36
+ $store: {
37
+ getters: {
38
+ currentStore: () => 'current_store',
39
+ 'current_store/schemaFor': jest.fn(),
40
+ 'current_store/all': jest.fn(),
41
+ 'i18n/t': () => 'Vim',
42
+ 'prefs/get': () => 'Vim',
43
+ 'prefs/theme': jest.fn(),
44
+ }
45
+ },
46
+ $route: { query: { AS: _YAML } },
47
+ $router: { applyQuery: jest.fn() },
48
+ },
49
+ }
50
+
51
+ };
52
+
53
+ // eslint-disable-next-line jest/no-disabled-tests
54
+ describe('keyMap info', () => {
55
+ (window as any).__codeMirrorLoader = () => new Promise((resolve) => {
56
+ resolve(true);
57
+ });
58
+
59
+ wrapper = shallowMount(
60
+ CodeMirror,
61
+ mountOptions,
62
+ );
63
+
64
+ it(`should show keyMap preference`, async() => {
65
+ await nextTick();
66
+
67
+ const keyMapBox = wrapper.find('[data-testid="code-mirror-keymap"] .keymap-indicator');
68
+
69
+ const closeIcon = wrapper.find('[data-testid="code-mirror-keymap"] .icon-close');
70
+
71
+ expect(keyMapBox).toBeDefined();
72
+ expect(closeIcon).toBeDefined();
73
+ });
74
+
75
+ it(`should remove keyMap box`, async() => {
76
+ await nextTick();
77
+
78
+ let keyMapBox = wrapper.find('[data-testid="code-mirror-keymap"]');
79
+
80
+ keyMapBox.trigger('mouseenter');
81
+ await nextTick();
82
+
83
+ const closeIcon = keyMapBox.find('.icon-close');
84
+
85
+ closeIcon.element.click();
86
+ await nextTick();
87
+
88
+ keyMapBox = wrapper.find('[data-testid="code-mirror-keymap"]');
89
+
90
+ expect(keyMapBox.exists()).toBe(false);
91
+ });
95
92
  });
96
93
  });
@@ -3,7 +3,7 @@ import ConsumptionGauge from '@shell/components/ConsumptionGauge.vue';
3
3
  import PercentageBar from '@shell/components/PercentageBar.vue';
4
4
 
5
5
  describe('component: ConsumptionGauge', () => {
6
- it.skip('(Vue3 Skip) should render component with the correct data applied', () => {
6
+ it('should render component with the correct data applied', () => {
7
7
  const colorStops = {
8
8
  0: '--success', 30: '--warning', 70: '--error'
9
9
  };
@@ -36,7 +36,7 @@ describe('component: ConsumptionGauge', () => {
36
36
 
37
37
  // checking PercentageBar component render
38
38
  expect(percentageBar.exists()).toBe(true);
39
- expect(Number(percentageBar.attributes().value)).toBe(20);
39
+ expect(percentageBar.props().modelValue).toBe(20);
40
40
  expect(percentageBar.props().colorStops).toStrictEqual(colorStops);
41
41
  });
42
42