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

Created functions to control css class names #298

Merged
merged 3 commits into from Feb 3, 2018

Conversation

rimlin
Copy link
Collaborator

@rimlin rimlin commented Jan 20, 2018

Created functions to manage css class names


export function hasCssClassName(element: HTMLImageElement | HTMLDivElement, cssClassName: string) {
return element.className && element.className.includes(cssClassName);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Even though these functions are quite simple, it should be nice to add some unit tests.

Copy link
Owner

Choose a reason for hiding this comment

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

We do not need to test replace and includes but the code has logic that checks if className is defined and that line 11 only should run if cssClassName don't exist.

@tjoskar
Copy link
Owner

tjoskar commented Jan 21, 2018

Thanks @rimlin, can you add a few test case for the code?

@rimlin
Copy link
Collaborator Author

rimlin commented Jan 21, 2018

@tjoskar yes, will add tests at this week.

@rimlin
Copy link
Collaborator Author

rimlin commented Jan 28, 2018

Added tests.

@tjoskar tjoskar merged commit b3e83b9 into tjoskar:master Feb 3, 2018
@tjoskar
Copy link
Owner

tjoskar commented Feb 3, 2018

Thanks @rimlin, I added a few missing semicolon: d38c76c

@tjoskar
Copy link
Owner

tjoskar commented Feb 3, 2018

Ref: #270

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants