@rancher/shell 0.3.21 → 0.3.23

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 (60) hide show
  1. package/assets/translations/en-us.yaml +4 -0
  2. package/assets/translations/zh-hans.yaml +8 -1
  3. package/babel.config.js +3 -0
  4. package/cloud-credential/__tests__/azure.test.ts +53 -0
  5. package/cloud-credential/azure.vue +6 -0
  6. package/components/GrowlManager.vue +33 -30
  7. package/components/SortableTable/paging.js +10 -0
  8. package/components/form/GitPicker.vue +16 -0
  9. package/components/form/ResourceQuota/ProjectRow.vue +38 -15
  10. package/components/form/SelectOrCreateAuthSecret.vue +9 -3
  11. package/components/formatter/ClusterProvider.vue +9 -3
  12. package/components/formatter/__tests__/ClusterProvider.test.ts +5 -1
  13. package/components/nav/Header.vue +1 -0
  14. package/config/settings.ts +59 -2
  15. package/config/types.js +2 -0
  16. package/creators/pkg/files/.github/workflows/build-extension-catalog.yml +28 -0
  17. package/creators/pkg/files/.github/workflows/build-extension-charts.yml +26 -0
  18. package/creators/pkg/init +63 -4
  19. package/detail/provisioning.cattle.io.cluster.vue +4 -2
  20. package/edit/fleet.cattle.io.gitrepo.vue +1 -0
  21. package/edit/provisioning.cattle.io.cluster/rke2.vue +4 -4
  22. package/edit/resources.cattle.io.backup.vue +3 -1
  23. package/edit/resources.cattle.io.restore.vue +3 -1
  24. package/mixins/__tests__/chart.test.ts +40 -0
  25. package/mixins/chart.js +5 -0
  26. package/models/catalog.cattle.io.clusterrepo.js +6 -2
  27. package/models/fleet.cattle.io.cluster.js +10 -2
  28. package/package.json +1 -1
  29. package/pages/c/_cluster/gatekeeper/index.vue +10 -1
  30. package/plugins/steve/__tests__/header-warnings.spec.ts +238 -0
  31. package/plugins/steve/actions.js +4 -23
  32. package/plugins/steve/header-warnings.ts +91 -0
  33. package/promptRemove/management.cattle.io.project.vue +9 -6
  34. package/rancher-components/BadgeState/BadgeState.vue +1 -5
  35. package/rancher-components/Banner/Banner.test.ts +1 -51
  36. package/rancher-components/Banner/Banner.vue +53 -134
  37. package/rancher-components/Card/Card.vue +7 -24
  38. package/rancher-components/Form/Checkbox/Checkbox.test.ts +29 -20
  39. package/rancher-components/Form/Checkbox/Checkbox.vue +20 -45
  40. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +8 -2
  41. package/rancher-components/Form/LabeledInput/LabeledInput.vue +10 -22
  42. package/rancher-components/Form/Radio/RadioButton.vue +13 -30
  43. package/rancher-components/Form/Radio/RadioGroup.vue +7 -26
  44. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -7
  45. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.test.ts +38 -25
  46. package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +11 -23
  47. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +5 -19
  48. package/rancher-components/StringList/StringList.test.ts +49 -453
  49. package/rancher-components/StringList/StringList.vue +58 -92
  50. package/scripts/extension/parse-tag-name +30 -0
  51. package/types/shell/index.d.ts +16 -9
  52. package/utils/__tests__/formatter.test.ts +77 -0
  53. package/utils/formatter.js +11 -0
  54. package/utils/settings.ts +2 -17
  55. package/vue-config-helper.js +135 -0
  56. package/vue.config.js +29 -141
  57. package/creators/pkg/files/.github/workflows/build-container.yml +0 -64
  58. package/creators/pkg/files/.github/workflows/build-extension.yml +0 -110
  59. package/rancher-components/Card/Card.test.ts +0 -37
  60. package/rancher-components/Form/Radio/RadioButton.test.ts +0 -31
@@ -0,0 +1,135 @@
1
+ const dev = (process.env.NODE_ENV !== 'production');
2
+ const devPorts = dev || process.env.DEV_PORTS === 'true';
3
+ const prime = process.env.PRIME;
4
+
5
+ let api = process.env.API || 'http://localhost:8989';
6
+
7
+ if ( !api.startsWith('http') ) {
8
+ api = `https://${ api }`;
9
+ }
10
+
11
+ // ===============================================================================================
12
+ // Functions for the request proxying used in dev
13
+ // ===============================================================================================
14
+
15
+ function proxyMetaOpts(target) {
16
+ return {
17
+ target,
18
+ followRedirects: true,
19
+ secure: !dev,
20
+ changeOrigin: true,
21
+ onProxyReq,
22
+ onProxyReqWs,
23
+ onError,
24
+ onProxyRes,
25
+ };
26
+ }
27
+
28
+ function proxyOpts(target) {
29
+ return {
30
+ target,
31
+ secure: !devPorts,
32
+ changeOrigin: true,
33
+ onProxyReq,
34
+ onProxyReqWs,
35
+ onError,
36
+ onProxyRes
37
+ };
38
+ }
39
+
40
+ // Intercept the /rancherversion API call wnad modify the 'RancherPrime' value
41
+ // if configured to do so by the environment variable PRIME
42
+ function proxyPrimeOpts(target) {
43
+ const opts = proxyOpts(target);
44
+
45
+ // Don't intercept if the PRIME environment variable is not set
46
+ if (!prime?.length) {
47
+ return opts;
48
+ }
49
+
50
+ opts.onProxyRes = (proxyRes, req, res) => {
51
+ const _end = res.end;
52
+ let body = '';
53
+
54
+ proxyRes.on( 'data', (data) => {
55
+ data = data.toString('utf-8');
56
+ body += data;
57
+ });
58
+
59
+ res.write = () => {};
60
+
61
+ res.end = () => {
62
+ let output = body;
63
+
64
+ try {
65
+ const out = JSON.parse(body);
66
+
67
+ out.RancherPrime = prime;
68
+ output = JSON.stringify(out);
69
+ } catch (err) {}
70
+
71
+ res.setHeader('content-length', output.length );
72
+ res.setHeader('content-type', 'application/json' );
73
+ res.setHeader('transfer-encoding', '');
74
+ res.setHeader('cache-control', 'no-cache');
75
+ res.writeHead(proxyRes.statusCode);
76
+ _end.apply(res, [output]);
77
+ };
78
+ };
79
+
80
+ return opts;
81
+ }
82
+
83
+ function onProxyRes(proxyRes, req, res) {
84
+ if (devPorts) {
85
+ proxyRes.headers['X-Frame-Options'] = 'ALLOWALL';
86
+ }
87
+ }
88
+
89
+ function proxyWsOpts(target) {
90
+ return {
91
+ ...proxyOpts(target),
92
+ ws: true,
93
+ changeOrigin: true,
94
+ };
95
+ }
96
+
97
+ function onProxyReq(proxyReq, req) {
98
+ if (!(proxyReq._currentRequest && proxyReq._currentRequest._headerSent)) {
99
+ proxyReq.setHeader('x-api-host', req.headers['host']);
100
+ proxyReq.setHeader('x-forwarded-proto', 'https');
101
+ }
102
+ }
103
+
104
+ function onProxyReqWs(proxyReq, req, socket, options, head) {
105
+ req.headers.origin = options.target.href;
106
+ proxyReq.setHeader('origin', options.target.href);
107
+ proxyReq.setHeader('x-api-host', req.headers['host']);
108
+ proxyReq.setHeader('x-forwarded-proto', 'https');
109
+ // console.log(proxyReq.getHeaders());
110
+
111
+ socket.on('error', (err) => {
112
+ console.error('Proxy WS Error:', err); // eslint-disable-line no-console
113
+ });
114
+ }
115
+
116
+ function onError(err, req, res) {
117
+ res.statusCode = 598;
118
+ console.error('Proxy Error:', err); // eslint-disable-line no-console
119
+ res.write(JSON.stringify(err));
120
+ }
121
+
122
+ module.exports = {
123
+ dev,
124
+ devPorts,
125
+ prime,
126
+ api,
127
+ proxyMetaOpts,
128
+ proxyOpts,
129
+ proxyPrimeOpts,
130
+ onProxyRes,
131
+ proxyWsOpts,
132
+ onProxyReq,
133
+ onProxyReqWs,
134
+ onError
135
+ };
package/vue.config.js CHANGED
@@ -5,6 +5,7 @@ const webpack = require('webpack');
5
5
  const { generateDynamicTypeImport } = require('./pkg/auto-import');
6
6
  const CopyWebpackPlugin = require('copy-webpack-plugin');
7
7
  const serverMiddlewares = require('./server/server-middleware.js');
8
+ const configHelper = require('./vue-config-helper.js');
8
9
 
9
10
  // Suppress info level logging messages from http-proxy-middleware
10
11
  // This hides all of the "[HPM Proxy created] ..." messages
@@ -20,24 +21,18 @@ console.info = oldInfoLogger; // eslint-disable-line no-console
20
21
  // const { STANDARD } = require('./config/private-label');
21
22
  const STANDARD = 1;
22
23
 
23
- const dev = (process.env.NODE_ENV !== 'production');
24
- const devPorts = dev || process.env.DEV_PORTS === 'true';
24
+ const dev = configHelper.dev;
25
+ const devPorts = configHelper.devPorts;
25
26
 
26
27
  // human readable version used on rancher dashboard about page
27
28
  const dashboardVersion = process.env.DASHBOARD_VERSION;
28
29
 
29
- const prime = process.env.PRIME;
30
-
31
30
  const pl = process.env.PL || STANDARD;
32
31
  const commit = process.env.COMMIT || 'head';
33
32
  const perfTest = (process.env.PERF_TEST === 'true'); // Enable performance testing when in dev
34
33
  const instrumentCode = (process.env.TEST_INSTRUMENT === 'true'); // Instrument code for code coverage in e2e tests
35
34
 
36
- let api = process.env.API || 'http://localhost:8989';
37
-
38
- if ( !api.startsWith('http') ) {
39
- api = `https://${ api }`;
40
- }
35
+ const api = configHelper.api;
41
36
  // ===============================================================================================
42
37
  // Nuxt configuration
43
38
  // ===============================================================================================
@@ -77,7 +72,9 @@ module.exports = function(dir, _appConfig) {
77
72
  ];
78
73
 
79
74
  if (instrumentCode) {
80
- babelPlugins.push('babel-plugin-istanbul');
75
+ babelPlugins.push([
76
+ 'babel-plugin-istanbul', { extension: ['.js', '.vue'] }, 'add-vue'
77
+ ]);
81
78
 
82
79
  console.warn('Instrumenting code for coverage'); // eslint-disable-line no-console
83
80
  }
@@ -276,26 +273,26 @@ module.exports = function(dir, _appConfig) {
276
273
  console.log(`API: '${ api }'. Env: '${ rancherEnv }'`); // eslint-disable-line no-console
277
274
  const proxy = {
278
275
  ...appConfig.proxies,
279
- '/k8s': proxyWsOpts(api), // Straight to a remote cluster (/k8s/clusters/<id>/)
280
- '/pp': proxyWsOpts(api), // For (epinio) standalone API
281
- '/api': proxyWsOpts(api), // Management k8s API
282
- '/apis': proxyWsOpts(api), // Management k8s API
283
- '/v1': proxyWsOpts(api), // Management Steve API
284
- '/v3': proxyWsOpts(api), // Rancher API
285
- '/v3-public': proxyOpts(api), // Rancher Unauthed API
286
- '/api-ui': proxyOpts(api), // Browser API UI
287
- '/meta': proxyMetaOpts(api), // Browser API UI
288
- '/v1-*': proxyOpts(api), // SAML, KDM, etc
289
- '/rancherversion': proxyPrimeOpts(api), // Rancher version endpoint
276
+ '/k8s': configHelper.proxyWsOpts(api), // Straight to a remote cluster (/k8s/clusters/<id>/)
277
+ '/pp': configHelper.proxyWsOpts(api), // For (epinio) standalone API
278
+ '/api': configHelper.proxyWsOpts(api), // Management k8s API
279
+ '/apis': configHelper.proxyWsOpts(api), // Management k8s API
280
+ '/v1': configHelper.proxyWsOpts(api), // Management Steve API
281
+ '/v3': configHelper.proxyWsOpts(api), // Rancher API
282
+ '/v3-public': configHelper.proxyOpts(api), // Rancher Unauthed API
283
+ '/api-ui': configHelper.proxyOpts(api), // Browser API UI
284
+ '/meta': configHelper.proxyMetaOpts(api), // Browser API UI
285
+ '/v1-*': configHelper.proxyOpts(api), // SAML, KDM, etc
286
+ '/rancherversion': configHelper.proxyPrimeOpts(api), // Rancher version endpoint
290
287
  // These are for Ember embedding
291
- '/c/*/edit': proxyOpts('https://127.0.0.1:8000'), // Can't proxy all of /c because that's used by Vue too
292
- '/k/': proxyOpts('https://127.0.0.1:8000'),
293
- '/g/': proxyOpts('https://127.0.0.1:8000'),
294
- '/n/': proxyOpts('https://127.0.0.1:8000'),
295
- '/p/': proxyOpts('https://127.0.0.1:8000'),
296
- '/assets': proxyOpts('https://127.0.0.1:8000'),
297
- '/translations': proxyOpts('https://127.0.0.1:8000'),
298
- '/engines-dist': proxyOpts('https://127.0.0.1:8000'),
288
+ '/c/*/edit': configHelper.proxyOpts('https://127.0.0.1:8000'), // Can't proxy all of /c because that's used by Vue too
289
+ '/k/': configHelper.proxyOpts('https://127.0.0.1:8000'),
290
+ '/g/': configHelper.proxyOpts('https://127.0.0.1:8000'),
291
+ '/n/': configHelper.proxyOpts('https://127.0.0.1:8000'),
292
+ '/p/': configHelper.proxyOpts('https://127.0.0.1:8000'),
293
+ '/assets': configHelper.proxyOpts('https://127.0.0.1:8000'),
294
+ '/translations': configHelper.proxyOpts('https://127.0.0.1:8000'),
295
+ '/engines-dist': configHelper.proxyOpts('https://127.0.0.1:8000'),
299
296
  };
300
297
 
301
298
  const config = {
@@ -456,7 +453,9 @@ module.exports = function(dir, _appConfig) {
456
453
  ];
457
454
 
458
455
  if (instrumentCode) {
459
- babelPlugins.push('babel-plugin-istanbul');
456
+ babelPlugins.push([
457
+ 'babel-plugin-istanbul', { extension: ['.js', '.vue'] }, 'add-vue'
458
+ ]);
460
459
 
461
460
  console.warn('Instrumenting code for coverage'); // eslint-disable-line no-console
462
461
  }
@@ -570,114 +569,3 @@ module.exports = function(dir, _appConfig) {
570
569
 
571
570
  return config;
572
571
  };
573
-
574
- // ===============================================================================================
575
- // Functions for the request proxying used in dev
576
- // ===============================================================================================
577
-
578
- function proxyMetaOpts(target) {
579
- return {
580
- target,
581
- followRedirects: true,
582
- secure: !dev,
583
- changeOrigin: true,
584
- onProxyReq,
585
- onProxyReqWs,
586
- onError,
587
- onProxyRes,
588
- };
589
- }
590
-
591
- function proxyOpts(target) {
592
- return {
593
- target,
594
- secure: !devPorts,
595
- changeOrigin: true,
596
- onProxyReq,
597
- onProxyReqWs,
598
- onError,
599
- onProxyRes
600
- };
601
- }
602
-
603
- // Intercept the /rancherversion API call wnad modify the 'RancherPrime' value
604
- // if configured to do so by the environment variable PRIME
605
- function proxyPrimeOpts(target) {
606
- const opts = proxyOpts(target);
607
-
608
- // Don't intercept if the PRIME environment variable is not set
609
- if (!prime?.length) {
610
- return opts;
611
- }
612
-
613
- opts.onProxyRes = (proxyRes, req, res) => {
614
- const _end = res.end;
615
- let body = '';
616
-
617
- proxyRes.on( 'data', (data) => {
618
- data = data.toString('utf-8');
619
- body += data;
620
- });
621
-
622
- res.write = () => {};
623
-
624
- res.end = () => {
625
- let output = body;
626
-
627
- try {
628
- const out = JSON.parse(body);
629
-
630
- out.RancherPrime = prime;
631
- output = JSON.stringify(out);
632
- } catch (err) {}
633
-
634
- res.setHeader('content-length', output.length );
635
- res.setHeader('content-type', 'application/json' );
636
- res.setHeader('transfer-encoding', '');
637
- res.setHeader('cache-control', 'no-cache');
638
- res.writeHead(proxyRes.statusCode);
639
- _end.apply(res, [output]);
640
- };
641
- };
642
-
643
- return opts;
644
- }
645
-
646
- function onProxyRes(proxyRes, req, res) {
647
- if (devPorts) {
648
- proxyRes.headers['X-Frame-Options'] = 'ALLOWALL';
649
- }
650
- }
651
-
652
- function proxyWsOpts(target) {
653
- return {
654
- ...proxyOpts(target),
655
- ws: true,
656
- changeOrigin: true,
657
- };
658
- }
659
-
660
- function onProxyReq(proxyReq, req) {
661
- if (!(proxyReq._currentRequest && proxyReq._currentRequest._headerSent)) {
662
- proxyReq.setHeader('x-api-host', req.headers['host']);
663
- proxyReq.setHeader('x-forwarded-proto', 'https');
664
- }
665
- }
666
-
667
- function onProxyReqWs(proxyReq, req, socket, options, head) {
668
- req.headers.origin = options.target.href;
669
- proxyReq.setHeader('origin', options.target.href);
670
- proxyReq.setHeader('x-api-host', req.headers['host']);
671
- proxyReq.setHeader('x-forwarded-proto', 'https');
672
- // console.log(proxyReq.getHeaders());
673
-
674
- socket.on('error', (err) => {
675
- console.error('Proxy WS Error:', err); // eslint-disable-line no-console
676
- });
677
- }
678
-
679
- function onError(err, req, res) {
680
- res.statusCode = 598;
681
- console.error('Proxy Error:', err); // eslint-disable-line no-console
682
- res.write(JSON.stringify(err));
683
- }
@@ -1,64 +0,0 @@
1
- name: Build and release container to registry
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- env:
9
- REGISTRY: ghcr.io
10
- IMAGE_NAME: ${{ github.repository }}
11
-
12
- jobs:
13
- build:
14
- name: Build container image
15
- if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
16
- runs-on: ubuntu-latest
17
- permissions: write-all
18
-
19
- steps:
20
- - name: Checkout repository
21
- uses: actions/checkout@v3
22
-
23
- - name: Configure Git
24
- run: |
25
- git config user.name "${{ github.actor }}"
26
- git config user.email "${{ github.actor }}@users.noreply.github.com"
27
-
28
- - name: Login to GitHub Container Registry
29
- uses: docker/login-action@v2
30
- with:
31
- registry: ${{ env.REGISTRY }}
32
- username: ${{ github.actor }}
33
- password: ${{ secrets.GITHUB_TOKEN }}
34
-
35
- - name: Setup Helm
36
- uses: azure/setup-helm@v3
37
- with:
38
- version: v3.8.0
39
-
40
- - name: Setup yq
41
- uses: chrisdickinson/setup-yq@v1.0.1
42
- with:
43
- yq-version: v4.28.2
44
-
45
- - name: Setup Nodejs and npm
46
- uses: actions/setup-node@v3
47
- with:
48
- node-version: '16'
49
-
50
- - name: Setup yarn
51
- run: npm install -g yarn
52
-
53
- - name: Setup Nodejs with yarn caching
54
- uses: actions/setup-node@v3
55
- with:
56
- node-version: '16'
57
- cache: yarn
58
-
59
- - name: Install dependencies
60
- run: yarn
61
-
62
- - name: Build and push UI image
63
- run: |
64
- yarn publish-pkgs -cp -r ${{ env.REGISTRY }} -o ${{ github.repository_owner }}
@@ -1,110 +0,0 @@
1
- name: Build and Release Extension
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
10
-
11
- env:
12
- ACTIONS_RUNNER_DEBUG: false
13
- CI_COMMIT_MESSAGE: CI Build Artifacts
14
-
15
- defaults:
16
- run:
17
- shell: bash
18
- working-directory: ./
19
-
20
- jobs:
21
- build:
22
- name: Build extension artifact
23
- runs-on: ubuntu-latest
24
- permissions: write-all
25
- steps:
26
- - name: Checkout
27
- uses: actions/checkout@v3
28
- with:
29
- fetch-depth: 0
30
-
31
- - name: Configure Git
32
- run: |
33
- git config user.name "$GITHUB_ACTOR"
34
- git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
35
-
36
- - name: Setup Helm
37
- uses: azure/setup-helm@v3
38
- with:
39
- version: v3.8.0
40
-
41
- - name: Setup yq
42
- uses: chrisdickinson/setup-yq@v1.0.1
43
- with:
44
- yq-version: v4.28.2
45
-
46
- - name: Setup Nodejs and npm
47
- uses: actions/setup-node@v3
48
- with:
49
- node-version: '16'
50
-
51
- - name: Setup yarn
52
- run: npm install -g yarn
53
-
54
- - name: Setup Nodejs with yarn caching
55
- uses: actions/setup-node@v3
56
- with:
57
- node-version: '16'
58
- cache: yarn
59
-
60
- - name: Install dependencies
61
- run: yarn
62
-
63
- - name: Run build script
64
- shell: bash
65
- id: build_script
66
- run: |
67
- yarn publish-pkgs -s "${{ github.repository }}" -b gh-pages
68
-
69
- - name: Upload charts artifact
70
- if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
71
- uses: actions/upload-artifact@v3
72
- with:
73
- name: charts
74
- path: tmp
75
-
76
- release:
77
- name: Release Build
78
- if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
79
- needs: build
80
- runs-on: ubuntu-latest
81
- permissions: write-all
82
- steps:
83
- - name: Checkout
84
- uses: actions/checkout@v3
85
- with:
86
- ref: gh-pages
87
-
88
- - name: Configure Git
89
- run: |
90
- git config user.name "$GITHUB_ACTOR"
91
- git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
92
-
93
- - name: Download build artifact
94
- uses: actions/download-artifact@v3
95
- with:
96
- name: charts
97
-
98
- - name: Commit build
99
- run: |
100
- git add ./{assets,charts,extensions,index.yaml}
101
- git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
102
- git push
103
-
104
- - name: Run chart-releaser
105
- uses: helm/chart-releaser-action@v1.4.1
106
- with:
107
- charts_dir: ./charts/*
108
- env:
109
- CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
110
- CR_SKIP_EXISTING: true
@@ -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,31 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
- import { RadioButton } from './index';
3
- import { cleanHtmlDirective } from '@shell/plugins/clean-html-directive';
4
-
5
- describe('radioButton.vue', () => {
6
- it('renders label slot contents', () => {
7
- const wrapper = shallowMount(RadioButton, { slots: { label: 'Test Label' } });
8
-
9
- expect(wrapper.find('.radio-label').text()).toBe('Test Label');
10
- });
11
-
12
- it('renders label prop contents', () => {
13
- const wrapper = shallowMount(
14
- RadioButton,
15
- {
16
- directives: { cleanHtmlDirective },
17
- propsData: { label: 'Test Label' }
18
- });
19
-
20
- expect(wrapper.find('.radio-label').text()).toBe('Test Label');
21
- });
22
-
23
- it('renders slot contents when both slot and label prop are provided', () => {
24
- const wrapper = shallowMount(RadioButton, {
25
- slots: { label: 'Test Label - Slot' },
26
- propsData: { label: 'Test Label - Props' },
27
- });
28
-
29
- expect(wrapper.find('.radio-label').text()).toBe('Test Label - Slot');
30
- });
31
- });