Merge branch 'master' of https://github.com/ONLYOFFICE/AppServer
This commit is contained in:
commit
73da553846
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "asc-web-components",
|
||||
"version": "1.0.196",
|
||||
"version": "1.0.197",
|
||||
"description": "Ascensio System SIA component library",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "dist/asc-web-components.js",
|
||||
|
@ -213,12 +213,13 @@ class FilterBlock extends React.Component {
|
||||
}
|
||||
render() {
|
||||
const _this = this;
|
||||
const filterItems = this.getFilterItems();
|
||||
return (
|
||||
<>
|
||||
<StyledFilterBlock ref={this.filterWrapper} id='filter-items-container'>
|
||||
{this.getFilterItems()}
|
||||
{filterItems}
|
||||
</StyledFilterBlock>
|
||||
<FilterButton id='filter-button' iconSize={this.props.iconSize} getData={_this.getData} isDisabled={this.props.isDisabled} />
|
||||
{filterItems.length > 0 && <FilterButton id='filter-button' iconSize={this.props.iconSize} getData={_this.getData} isDisabled={this.props.isDisabled} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ function getData() {
|
||||
{ key: 'filter-other', group: 'filter-other', label: 'Other', isHeader: true },
|
||||
{ key: '0', group: 'filter-other', subgroup: 'filter-groups', defaultSelectLabel: 'Select', label: 'Groups' },
|
||||
{ key: '0', inSubgroup: true, group: 'filter-groups', label: 'Administration'},
|
||||
{ key: '1', inSubgroup: true, group: 'filter-groups', label: 'Public Relations'},
|
||||
{ key: '1', inSubgroup: true, group: 'filter-groups', label: 'Public Relations'}
|
||||
];
|
||||
}
|
||||
function getSortData() {
|
||||
|
@ -212,7 +212,9 @@ class FilterInput extends React.Component {
|
||||
const fullWidth = this.searchWrapper.current.getBoundingClientRect().width;
|
||||
const filterWidth = this.filterWrapper.current.getBoundingClientRect().width;
|
||||
const filterArr = Array.from(Array.from(this.filterWrapper.current.children).find(x => x.id === 'filter-items-container').children);
|
||||
const filterButton = Array.from(Array.from(this.filterWrapper.current.children).find(x => x.id != 'filter-items-container').children)[0];
|
||||
const searchFilterButton = Array.from(this.filterWrapper.current.children).find(x => x.id != 'filter-items-container');
|
||||
|
||||
const filterButton = searchFilterButton ? Array.from(searchFilterButton.children)[0] : null;
|
||||
|
||||
if (fullWidth <= this.minWidth && fullWidth > 0) {
|
||||
this.setState({
|
||||
@ -228,7 +230,7 @@ class FilterInput extends React.Component {
|
||||
elementsWidth = elementsWidth + element.getBoundingClientRect().width;
|
||||
});
|
||||
|
||||
if (elementsWidth >= (fullWidth / 3) - filterButton.getBoundingClientRect().width) {
|
||||
if ( filterButton !== null && (elementsWidth >= (fullWidth / 3) - filterButton.getBoundingClientRect().width)) {
|
||||
for (let i = 0; i < filterArr.length; i++) {
|
||||
if (elementsWidth > (fullWidth / 3) - filterButton.getBoundingClientRect().width) {
|
||||
elementsWidth = elementsWidth - filterArr[i].getBoundingClientRect().width;
|
||||
|
@ -16,16 +16,31 @@ describe("<ToggleButton />", () => {
|
||||
});
|
||||
|
||||
it("Toggle button componentDidUpdate() test", () => {
|
||||
const wrapper = mount(<ToggleButton isChecked={false} />).instance();
|
||||
const wrapper = mount(
|
||||
<ToggleButton
|
||||
isChecked={false}
|
||||
onChange={event => console.log(event.target.value)}
|
||||
/>
|
||||
).instance();
|
||||
wrapper.componentDidUpdate(wrapper.props);
|
||||
|
||||
const wrapper2 = mount(<ToggleButton isChecked={true} />).instance();
|
||||
const wrapper2 = mount(
|
||||
<ToggleButton
|
||||
isChecked={true}
|
||||
onChange={event => console.log(event.target.value)}
|
||||
/>
|
||||
).instance();
|
||||
wrapper2.componentDidUpdate(wrapper2.props);
|
||||
|
||||
const wrapper3 = shallow(<ToggleButton isChecked={false} />);
|
||||
const wrapper3 = shallow(
|
||||
<ToggleButton
|
||||
isChecked={false}
|
||||
onChange={event => console.log(event.target.value)}
|
||||
/>
|
||||
);
|
||||
wrapper3.setState({ isOpen: true });
|
||||
wrapper3.instance().componentDidUpdate(wrapper3.props());
|
||||
|
||||
|
||||
expect(wrapper.props).toBe(wrapper.props);
|
||||
expect(wrapper.state.checked).toBe(wrapper.props.isChecked);
|
||||
expect(wrapper2.props).toBe(wrapper2.props);
|
||||
|
Loading…
Reference in New Issue
Block a user