-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(react): tests for React plugin including a mocked server-side re…
…nder
- Loading branch information
Showing
3 changed files
with
113 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { open, getIndicator, noIndicators } from '../helper.js' | ||
|
||
describe('Basic tests for table elements', () => { | ||
it('Regular react version works.', () => { | ||
const className = '.react-regular' | ||
open() | ||
cy.get(className).should('be.visible') | ||
|
||
// Verify basic functionality also works with react. | ||
getIndicator(className, 'left').should('not.be.visible') | ||
getIndicator(className, 'right').should('be.visible') | ||
|
||
// Parent as it's an inline element. | ||
cy.get(className).should('have.prop', 'scrollLeft', 0) | ||
|
||
// Scroll right. | ||
getIndicator(className, 'right').click() | ||
|
||
cy.get(className).should('not.have.prop', 'scrollLeft', 0) | ||
|
||
getIndicator(className, 'left').should('be.visible') | ||
getIndicator(className, 'right').should('be.visible') | ||
}) | ||
it('React with childAsElement works.', () => { | ||
const className = '.react-child' | ||
open() | ||
cy.get(className).should('be.visible') | ||
|
||
getIndicator(className, 'left').should('not.be.visible') | ||
getIndicator(className, 'right').should('be.visible') | ||
}) | ||
}) | ||
|
||
describe('Preserves layout with server-side rendering.', () => { | ||
it('Server-side regular react version works.', () => { | ||
const className = '.react-server-regular' | ||
open() | ||
cy.get(className).should('be.visible') | ||
|
||
// Indicators are be layout preserving and will only be added on the client. | ||
noIndicators(className) | ||
|
||
// Tiles layout kept horizontal. | ||
cy.get(className).invoke('height').should('be.lt', 300) | ||
}) | ||
it('childAsElement works on the server.', () => { | ||
const className = '.react-server-child' | ||
open() | ||
cy.get(className).should('be.visible') | ||
|
||
noIndicators(className) | ||
|
||
cy.get(className).invoke('height').should('be.lt', 300) | ||
}) | ||
}) |
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