-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TT-10495 added tests for text ellipsis (#317)
* TT-10495 added tests for text ellipsis
- Loading branch information
Showing
3 changed files
with
49 additions
and
14 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
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 |
---|---|---|
@@ -1,7 +1,33 @@ | ||
import React from 'react'; | ||
import TextEllipsis from './index'; | ||
|
||
function Component() { | ||
return ( | ||
<div className="text-ellipsis" style={{ marginTop: '200px', textAlign: 'center' }}> | ||
<TextEllipsis | ||
text="alpha, bravo, charlie, delta, forgot the rest" | ||
limit={10} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
describe('TextEllipsis', () => { | ||
it('TODO', () => { | ||
expect(true).to.equal(true); | ||
const classes = { | ||
floatingContainer: 'floating-container', | ||
}; | ||
it('should show just first 10 chars followed by "..."', () => { | ||
cy.mount(<Component />) | ||
.get('.text-ellipsis') | ||
.should('have.text', 'alpha, bra...'); | ||
}); | ||
it('when hovering the shrinked texts, shows the tooltip with full text', () => { | ||
cy.mount(<Component />); | ||
cy.get(`.${classes.floatingContainer}`) | ||
.should('not.exist') | ||
.get('.text-ellipsis') | ||
.trigger('mouseover') | ||
.get(`.${classes.floatingContainer}`) | ||
.should('exist'); | ||
}); | ||
}); |
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