-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(fluid-components): increase coverage and fix skeleton components (…
- Loading branch information
1 parent
a24e338
commit b7c523a
Showing
14 changed files
with
220 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/react/src/components/FluidComboBox/__tests__/FluidComboBoxSkeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; | ||
import FluidComboBoxSkeleton from '../FluidComboBox.Skeleton'; | ||
|
||
describe('FluidComboBoxSkeleton', () => { | ||
it('should render with fluid classes', async () => { | ||
const items = generateItems(4, generateGenericItem); | ||
const { container } = render(<FluidComboBoxSkeleton />); | ||
expect(container.firstChild).toHaveClass(`cds--list-box__wrapper--fluid`); | ||
}); | ||
|
||
it('should support a custom `className` prop on the outermost element', () => { | ||
const { container } = render(<FluidComboBoxSkeleton className="test" />); | ||
expect(container.firstChild).toHaveClass('test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/react/src/components/FluidDropdown/__tests__/FluidDropdownSkeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; | ||
import FluidDropdownSkeleton from '../FluidDropdown.Skeleton'; | ||
|
||
describe('FluidDropdownSkeleton', () => { | ||
it('should render with fluid classes', async () => { | ||
const items = generateItems(4, generateGenericItem); | ||
const { container } = render(<FluidDropdownSkeleton />); | ||
expect(container.firstChild).toHaveClass(`cds--list-box__wrapper--fluid`); | ||
}); | ||
|
||
it('should support a custom `className` prop on the outermost element', () => { | ||
const { container } = render(<FluidDropdownSkeleton className="test" />); | ||
expect(container.firstChild).toHaveClass('test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/react/src/components/FluidMultiSelect/__tests__/FluidMultiSelect-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; | ||
import FluidMultiSelect from '../FluidMultiSelect'; | ||
|
||
describe('FluidMultiSelect', () => { | ||
it('should render with fluid classes', async () => { | ||
const items = generateItems(4, generateGenericItem); | ||
const { container } = render( | ||
<FluidMultiSelect id="test" label="Field" items={items} /> | ||
); | ||
expect(container.firstChild).toHaveClass(`cds--list-box__wrapper--fluid`); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
packages/react/src/components/FluidMultiSelect/__tests__/FluidMultiSelectSkeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; | ||
import FluidMultiSelectSkeleton from '../FluidMultiSelect.Skeleton'; | ||
|
||
describe('FluidMultiSelectSkeleton', () => { | ||
it('should render with fluid classes', async () => { | ||
const items = generateItems(4, generateGenericItem); | ||
const { container } = render( | ||
<FluidMultiSelectSkeleton id="test" label="Field" items={items} /> | ||
); | ||
expect(container.firstChild).toHaveClass(`cds--list-box__wrapper--fluid`); | ||
}); | ||
|
||
it('should support a custom `className` prop on the outermost element', () => { | ||
const { container } = render(<FluidMultiSelectSkeleton className="test" />); | ||
expect(container.firstChild).toHaveClass('test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/react/src/components/FluidSelect/__tests__/FluidSelectSkeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; | ||
import FluidSelectSkeleton from '../FluidSelect.Skeleton'; | ||
|
||
describe('FluidSelectSkeleton', () => { | ||
it('should render with fluid classes', async () => { | ||
const items = generateItems(4, generateGenericItem); | ||
const { container } = render(<FluidSelectSkeleton />); | ||
expect(container.firstChild).toHaveClass(`cds--list-box__wrapper--fluid`); | ||
}); | ||
|
||
it('should support a custom `className` prop on the outermost element', () => { | ||
const { container } = render(<FluidSelectSkeleton className="test" />); | ||
expect(container.firstChild).toHaveClass('test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/react/src/components/FluidTextArea/__tests__/FluidTextAreaSkeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import FluidTextAreaSkeleton from '../FluidTextArea.Skeleton'; | ||
|
||
describe('FluidTextAreaSkeleton', () => { | ||
it('should render with fluid classes', async () => { | ||
const { container } = render(<FluidTextAreaSkeleton />); | ||
expect(container.firstChild).toHaveClass(`cds--text-area--fluid__skeleton`); | ||
}); | ||
|
||
it('should support a custom `className` prop on the outermost element', () => { | ||
const { container } = render(<FluidTextAreaSkeleton className="test" />); | ||
expect(container.firstChild).toHaveClass('test'); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
packages/react/src/components/FluidTextInput/__tests__/FluidPasswordInput-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { generateItems, generateGenericItem } from '../../ListBox/test-helpers'; | ||
import FluidPasswordInput from '../FluidPasswordInput'; | ||
|
||
describe('FluidPasswordInput', () => { | ||
it('should render with fluid classes', async () => { | ||
const items = generateItems(4, generateGenericItem); | ||
const { container } = render( | ||
<FluidPasswordInput id="input-1" labelText="PasswordInput label" /> | ||
); | ||
expect(container.firstChild).toHaveClass(`cds--text-input--fluid`); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/react/src/components/FluidTextInput/__tests__/FluidTextInputSkeleton-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import FluidTextInputSkeleton from '../FluidTextInput.Skeleton'; | ||
|
||
describe('FluidTextInputSkeleton', () => { | ||
it('should render with fluid classes', async () => { | ||
const { container } = render(<FluidTextInputSkeleton />); | ||
expect(container.firstChild).toHaveClass( | ||
`cds--text-input--fluid__skeleton` | ||
); | ||
}); | ||
|
||
it('should support a custom `className` prop on the outermost element', () => { | ||
const { container } = render(<FluidTextInputSkeleton className="test" />); | ||
expect(container.firstChild).toHaveClass('test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters