Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests for ChipWithIcon Component issue #39 #53

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions nightwatch/components/chipWithIcon.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import ChipWithIcon from '../../src/components/ChipWithIcon';
import { Error } from '../../src/icons';
import GlobalStyles from '../../src/components/GlobalStyles';

export default {
title: 'Chip With Icon Component',
component: ChipWithIcon
};

export const ChipWithIconComponent = () => (
<>
<GlobalStyles />
<ChipWithIcon icon={<Error data-testid="chip-icon" />}>
Sample Chip
</ChipWithIcon>
</>
);

export const ChipWithIconComponentWithTransformText = () => (
<>
<GlobalStyles />
<ChipWithIcon transformText icon={<Error data-testid="chip-icon" />} >
Sample Chip
</ChipWithIcon>
</>
);

ChipWithIconComponent.test = async (browser, { component }) => {
browser.expect(component).to.be.visible;
browser.expect(component).text.to.equal('Sample Chip');
browser.expect.element('[data-testid="chip-icon"]').to.be.present;
};

ChipWithIconComponentWithTransformText.test = async (browser, { component }) => {
browser.expect(component).to.be.visible;
browser.expect.element('[data-testid="chip-icon"]').to.be.present;
browser.expect(component).text.to.equal('sample chip');
Copy link
Member

@vaibhavsingh97 vaibhavsingh97 Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transformText converts sample chip to Sample chip

Copy link
Author

@aliamerj aliamerj Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do i need to add other test with "sample chip" and expect "Sample chip" ??

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just change the values and keep it two tests ??

Copy link
Author

@aliamerj aliamerj Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vaibhavsingh97
when enable the transformText it did not convert sample chip to Sample chip
as you can see
image
with test
image

image

I don't get it

  • it works fine in the app
  • in the test it dose the opposite

I think this happens because the inner component <Text> ,maybe

so what do you think ?

};
Loading