Skip to content

Commit cf43b7b

Browse files
committed
tests: update tests
1 parent 9fe451e commit cf43b7b

File tree

15 files changed

+1033
-1102
lines changed

15 files changed

+1033
-1102
lines changed

jest.config.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
"use strict";
8+
'use strict'
99

1010
module.exports = {
11-
moduleFileExtensions: ["tsx", "js", "ts", "json", "vue"],
12-
preset: "ts-jest",
13-
setupFiles: ["jest-canvas-mock"],
14-
testEnvironment: "jsdom",
15-
testPathIgnorePatterns: ["dist/"],
11+
moduleFileExtensions: ['tsx', 'js', 'ts', 'json', 'vue'],
12+
preset: 'ts-jest',
13+
setupFiles: ['jest-canvas-mock'],
14+
testEnvironment: 'jsdom',
15+
testEnvironmentOptions: {
16+
customExportConditions: ['node', 'node-addons'],
17+
},
18+
testPathIgnorePatterns: ['dist/'],
1619
transform: {
17-
".*\\.(ts)$": "ts-jest",
18-
".*\\.(vue)$": "vue-jest",
20+
'.*\\.(ts)$': 'ts-jest',
21+
'.*\\.(vue)$': '@vue/vue3-jest',
1922
},
20-
};
23+
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
"@vue/compiler-sfc": "^3.2.37",
2727
"@vue/eslint-config-prettier": "^7.0.0",
2828
"@vue/eslint-config-typescript": "^11.0.0",
29+
"@vue/vue3-jest": "28.0.1",
2930
"eslint": "8.20.0",
3031
"eslint-plugin-prettier": "^4.2.1",
3132
"eslint-plugin-vue": "^9.3.0",
3233
"jest": "^28.1.3",
3334
"jest-canvas-mock": "^2.4.0",
35+
"jest-environment-jsdom": "^28.1.3",
3436
"lerna": "^4.0.0",
3537
"prettier": "^2.7.1",
36-
"ts-jest": "^28.0.7",
37-
"vue-jest": "^5.0.0-0"
38+
"ts-jest": "^28.0.7"
3839
}
3940
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Customize CCloseButton component renders correctly 1`] = `"<button class=\\"btn btn-close btn-close-white\\" aria-label=\\"Close\\" disabled=\\"\\"></button>"`;
3+
exports[`Customize CCloseButton component renders correctly 1`] = `"<button type=\\"button\\" class=\\"btn btn-close btn-close-white\\" aria-label=\\"Close\\" disabled=\\"\\"></button>"`;
44
5-
exports[`Loads and display CCloseButton component renders correctly 1`] = `"<button class=\\"btn btn-close\\" aria-label=\\"Close\\"></button>"`;
5+
exports[`Loads and display CCloseButton component renders correctly 1`] = `"<button type=\\"button\\" class=\\"btn btn-close\\" aria-label=\\"Close\\"></button>"`;

packages/coreui-vue/src/components/form/__tests__/CFormInput.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe(`Loads and display ${ComponentName} component`, () => {
4949
})
5050
it('contain slots and classes', () => {
5151
expect(defaultWrapper.text()).toContain('Default slot')
52-
expect(defaultWrapper.classes('form-control')).toBe(true)
52+
expect(defaultWrapper.find('input').classes('form-control')).toBe(true)
5353
})
5454
})
5555

@@ -59,11 +59,11 @@ describe(`Customize ${ComponentName} component`, () => {
5959
})
6060
it('contain slots and classes', () => {
6161
expect(customWrapper.text()).toContain('Default slot')
62-
expect(customWrapper.classes('form-control-plaintext')).toBe(true)
63-
expect(customWrapper.classes('form-control-color')).toBe(true)
64-
expect(customWrapper.classes('form-control-lg')).toBe(true)
65-
expect(customWrapper.classes('is-invalid')).toBe(true)
66-
expect(customWrapper.classes('is-valid')).toBe(true)
62+
expect(customWrapper.find('input').classes('form-control-plaintext')).toBe(true)
63+
expect(customWrapper.find('input').classes('form-control-color')).toBe(true)
64+
expect(customWrapper.find('input').classes('form-control-lg')).toBe(true)
65+
expect(customWrapper.find('input').classes('is-invalid')).toBe(true)
66+
expect(customWrapper.find('input').classes('is-valid')).toBe(true)
6767
})
6868
})
6969

@@ -73,10 +73,10 @@ describe(`Customize (two) ${ComponentName} component`, () => {
7373
})
7474
it('contain slots and classes', () => {
7575
expect(customWrapperTwo.text()).toContain('Default slot')
76-
expect(customWrapperTwo.classes('form-control')).toBe(true)
77-
expect(customWrapper.classes('form-control-color')).toBe(true)
78-
expect(customWrapper.classes('form-control-lg')).toBe(true)
79-
expect(customWrapper.classes('is-invalid')).toBe(true)
80-
expect(customWrapper.classes('is-valid')).toBe(true)
76+
expect(customWrapperTwo.find('input').classes('form-control')).toBe(true)
77+
expect(customWrapper.find('input').classes('form-control-color')).toBe(true)
78+
expect(customWrapper.find('input').classes('form-control-lg')).toBe(true)
79+
expect(customWrapper.find('input').classes('is-invalid')).toBe(true)
80+
expect(customWrapper.find('input').classes('is-valid')).toBe(true)
8181
})
8282
})

packages/coreui-vue/src/components/form/__tests__/CFormRange.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ describe(`Loads and display ${ComponentName} component`, () => {
3333
})
3434
it('contain slots and classes', () => {
3535
expect(defaultWrapper.text()).toContain('Default slot')
36-
expect(defaultWrapper.classes('form-range')).toBe(true)
37-
expect(defaultWrapper.attributes('type')).toBe('range')
36+
expect(defaultWrapper.find('input').classes('form-range')).toBe(true)
37+
expect(defaultWrapper.find('input').attributes('type')).toBe('range')
3838
})
3939
})
4040

@@ -44,12 +44,12 @@ describe(`Customize ${ComponentName} component`, () => {
4444
})
4545
it('contain slots and classes', () => {
4646
expect(customWrapper.text()).toContain('Default slot')
47-
expect(customWrapper.classes('form-range')).toBe(true)
48-
expect(customWrapper.attributes('type')).toBe('range')
49-
expect(customWrapper.attributes('disabled')).toBe('')
50-
expect(customWrapper.attributes('max')).toBe('400')
51-
expect(customWrapper.attributes('min')).toBe('50')
52-
expect(customWrapper.attributes('readonly')).toBe('')
53-
expect(customWrapper.attributes('steps')).toBe('10')
47+
expect(customWrapper.find('input').classes('form-range')).toBe(true)
48+
expect(customWrapper.find('input').attributes('type')).toBe('range')
49+
expect(customWrapper.find('input').attributes('disabled')).toBe('')
50+
expect(customWrapper.find('input').attributes('max')).toBe('400')
51+
expect(customWrapper.find('input').attributes('min')).toBe('50')
52+
expect(customWrapper.find('input').attributes('readonly')).toBe('')
53+
expect(customWrapper.find('input').attributes('steps')).toBe('10')
5454
})
5555
})

packages/coreui-vue/src/components/form/__tests__/CFormSelect.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe(`Loads and display ${ComponentName} component`, () => {
3131
})
3232
it('contain slots and classes', () => {
3333
expect(defaultWrapper.text()).toContain('Default slot')
34-
expect(defaultWrapper.classes('form-select')).toBe(true)
34+
expect(defaultWrapper.find('select').classes('form-select')).toBe(true)
3535
})
3636
})
3737

@@ -41,8 +41,8 @@ describe(`Customize ${ComponentName} component`, () => {
4141
})
4242
it('contain slots and classes', () => {
4343
expect(customWrapper.text()).toContain('Default slot')
44-
expect(customWrapper.classes('form-select')).toBe(true)
45-
expect(customWrapper.classes('form-select-lg')).toBe(true)
46-
expect(customWrapper.attributes('size')).toBe('200')
44+
expect(customWrapper.find('select').classes('form-select')).toBe(true)
45+
expect(customWrapper.find('select').classes('form-select-lg')).toBe(true)
46+
expect(customWrapper.find('select').attributes('size')).toBe('200')
4747
})
4848
})

packages/coreui-vue/src/components/form/__tests__/CFormTextarea.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe(`Loads and display ${ComponentName} component`, () => {
3232
})
3333
it('contain slots and classes', () => {
3434
expect(defaultWrapper.text()).toContain('Default slot')
35-
expect(defaultWrapper.classes('form-control')).toBe(true)
35+
expect(defaultWrapper.find('textarea').classes('form-control')).toBe(true)
3636
})
3737
})
3838

@@ -42,8 +42,8 @@ describe(`Customize ${ComponentName} component`, () => {
4242
})
4343
it('contain slots and classes', () => {
4444
expect(customWrapper.text()).toContain('Default slot')
45-
expect(customWrapper.classes('form-control-plaintext')).toBe(true)
46-
expect(customWrapper.classes('is-invalid')).toBe(true)
47-
expect(customWrapper.classes('is-valid')).toBe(true)
45+
expect(customWrapper.find('textarea').classes('form-control-plaintext')).toBe(true)
46+
expect(customWrapper.find('textarea').classes('is-invalid')).toBe(true)
47+
expect(customWrapper.find('textarea').classes('is-valid')).toBe(true)
4848
})
4949
})
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Customize with label - CFormCheck component renders correctly 1`] = `"<input class=\\"btn-check is-invalid is-valid\\" id=\\"uniqueid\\" type=\\"checkbox\\"><label class=\\"btn btn-outline-warning btn-lg rounded-circle\\" for=\\"uniqueid\\">some label</label>"`;
3+
exports[`Customize with label - CFormCheck component renders correctly 1`] = `
4+
"<input class=\\"btn-check is-invalid is-valid\\" id=\\"uniqueid\\" type=\\"checkbox\\">
5+
<label class=\\"btn btn-outline-warning btn-lg rounded-circle\\" disabled=\\"false\\" for=\\"uniqueid\\">some label</label>"
6+
`;
47
5-
exports[`Customize with label in slot - CFormCheck component renders correctly 1`] = `"<input class=\\"btn-check is-invalid is-valid\\" id=\\"uniqueid\\" type=\\"checkbox\\"><label class=\\"btn btn-outline-warning btn-lg rounded-circle\\" for=\\"uniqueid\\">some label</label>"`;
8+
exports[`Customize with label in slot - CFormCheck component renders correctly 1`] = `
9+
"<input class=\\"btn-check is-invalid is-valid\\" id=\\"uniqueid\\" type=\\"checkbox\\">
10+
<label class=\\"btn btn-outline-warning btn-lg rounded-circle\\" disabled=\\"false\\" for=\\"uniqueid\\">some label</label>"
11+
`;
612
713
exports[`Loads and display CFormCheck component renders correctly 1`] = `"<input class=\\"form-check-input\\" type=\\"checkbox\\">"`;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Customize CFormRange component renders correctly 1`] = `"<input class=\\"form-range\\" disabled=\\"\\" max=\\"400\\" min=\\"50\\" steps=\\"10\\" readonly=\\"\\" type=\\"range\\">"`;
3+
exports[`Customize CFormRange component renders correctly 1`] = `"<input class=\\"form-range\\" disabled=\\"\\" max=\\"400\\" min=\\"50\\" readonly=\\"\\" steps=\\"10\\" type=\\"range\\">"`;
44
55
exports[`Loads and display CFormRange component renders correctly 1`] = `"<input class=\\"form-range\\" type=\\"range\\">"`;

packages/coreui-vue/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ exports[`Customize CModal component renders correctly 1`] = `
77
<div class=\\"modal-content bazinga\\">Default slot</div>
88
</div>
99
</div>
10-
</transition-stub>
11-
<!---->"
10+
</transition-stub>"
1211
`;
1312
1413
exports[`Loads and display CModal component renders correctly 1`] = `

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy