Skip to content

Commit

Permalink
fix(Cascader): set listStyle height style error
Browse files Browse the repository at this point in the history
  • Loading branch information
myronliu347 committed Feb 21, 2019
1 parent 1680773 commit 61ea4f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cascader/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $cascader-menu-border: $cascader-menu-border-width $line-solid $cascader-menu-bo
border-radius: 0;
box-shadow: none;
min-width: auto;
min-height: $s-8 * 6;
min-height: 100%;
&.#{$css-prefix}has-right-border {
border-right: $cascader-menu-border;
}
Expand Down
18 changes: 13 additions & 5 deletions test/cascader/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,20 @@ describe('Cascader', () => {
});

it('should support listClassName and listStyle', () => {
wrapper = mount(<Cascader dataSource={ChinaArea} listStyle={{ width: '400px', height: '400px' }} listClassName="custom" />);
const div = document.createElement('div');
document.body.appendChild(div);

ReactDOM.render(<Cascader dataSource={ChinaArea} listStyle={{ width: '400px', height: '400px' }} listClassName="custom" />, div);

const list = wrapper.find('div.next-cascader-menu-wrapper');
assert(list.prop('style').width === '400px');
assert(list.prop('style').height === '400px');
assert(list.hasClass('custom'));
const list = div.querySelector('.next-cascader-menu-wrapper');
assert(list.style.width === '400px');
assert(list.style.height === '400px');
assert(window.getComputedStyle(list.querySelector('.next-cascader-menu')).width === '400px');
assert(window.getComputedStyle(list.querySelector('.next-cascader-menu')).height === '400px');
assert(list.className.indexOf('custom') !== -1);

ReactDOM.unmountComponentAtNode(div);
document.body.removeChild(div);
});

it('should support keyboard', () => {
Expand Down

0 comments on commit 61ea4f7

Please sign in to comment.