-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add hidden property to polymer based components (#171)
- Loading branch information
1 parent
02ff2c6
commit ee49217
Showing
3 changed files
with
60 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
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,33 @@ | ||
import { expect, use as useChaiPlugin } from '@esm-bundle/chai'; | ||
import { render } from '@testing-library/react'; | ||
import chaiDom from 'chai-dom'; | ||
import { SideNav, SideNavElement } from '../src/SideNav.js'; | ||
import { findByQuerySelector } from './utils/findByQuerySelector.js'; | ||
|
||
useChaiPlugin(chaiDom); | ||
|
||
describe('SideNav', () => { | ||
describe('boolean property', () => { | ||
const booleanProperties: Array<keyof typeof SideNavElement.prototype & string> = [ | ||
'hidden', | ||
'collapsed', | ||
'draggable', | ||
]; | ||
|
||
booleanProperties.forEach((property) => { | ||
describe(property, () => { | ||
it(`should be true in the element if ${property} prop is true`, async () => { | ||
render(<SideNav {...{ [property]: true }} />); | ||
const sideNav = await findByQuerySelector('vaadin-side-nav'); | ||
expect(sideNav[property]).to.be.ok; | ||
}); | ||
|
||
it(`should be false in the element if ${property} prop is false`, async () => { | ||
render(<SideNav {...{ [property]: false }} />); | ||
const sideNav = await findByQuerySelector('vaadin-side-nav'); | ||
expect(sideNav[property]).not.to.be.ok; | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |