Skip to content

Commit

Permalink
fix(select): test
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored and dpellier committed Oct 30, 2024
1 parent 34fa0a4 commit 53b7a84
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/examples/react-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@ovhcloud/ods-components": "18.2.0",
"@ovhcloud/ods-themes": "18.2.0",
"@tanstack/react-query": "^5.59.16",
"@tanstack/react-query": "5.59.16",
"formik": "2.4.6",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ describe('ods-select behaviour', () => {
});
});

describe('on Slot change', () => {
describe('on slot change', () => {
it('should render with is-disabled', async() => {
await setup('<ods-select is-disabled><option value="1">Value 1</option></ods-select>');
expect(selectComponent.classList.contains('disabled')).toBe(true);
Expand All @@ -236,7 +236,7 @@ describe('ods-select behaviour', () => {
await page.waitForChanges();

expect(await page.evaluate(() => {
return document.querySelector('ods-select')?.shadowRoot?.querySelector('.ts-wrapper')?.classList.contains('disabled') || false;
return document.querySelector('ods-select')?.shadowRoot?.querySelector('.ts-wrapper')?.classList.contains('disabled');
})).toBe(false);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,20 @@ describe('ods-select rendering', () => {

expect(selectComponent.classList.contains('disabled')).toBe(true);
});

describe('watchers', () => {
describe('isDisabled', () => {
it('should disable the select component', async() => {
await setup('<ods-select><option value="1">1</option></ods-select>');
expect(selectComponent.classList.contains('disabled')).toBe(false);

el.setAttribute('is-disabled', true);
await page.waitForChanges();

expect(await page.evaluate(() => {
return document.querySelector('ods-select')?.shadowRoot?.querySelector('.ts-wrapper')?.classList.contains('disabled') || false;
})).toBe(true);
});
});
});
});
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5422,7 +5422,7 @@ __metadata:
languageName: node
linkType: hard

"@tanstack/react-query@npm:^5.59.16":
"@tanstack/react-query@npm:5.59.16":
version: 5.59.16
resolution: "@tanstack/react-query@npm:5.59.16"
dependencies:
Expand Down Expand Up @@ -18738,7 +18738,7 @@ __metadata:
"@babel/preset-typescript": 7.23.3
"@ovhcloud/ods-components": 18.2.0
"@ovhcloud/ods-themes": 18.2.0
"@tanstack/react-query": ^5.59.16
"@tanstack/react-query": 5.59.16
"@types/react": 18.2.56
"@types/react-dom": 18.2.19
babel-loader: 9.1.3
Expand Down

0 comments on commit 53b7a84

Please sign in to comment.