mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: refactor submenu's right nav to accept list of buttons (#11102)
* submenu right-nav button refactor * undo changes * fix lint * fix test * update pr with suggested changes and test * fix lint * use enum to define btn style props * add suggestions * update savedquery buttons
This commit is contained in:
committed by
GitHub
parent
2a906bc9d1
commit
07716ffd76
@@ -85,4 +85,24 @@ describe('SubMenu', () => {
|
||||
expect(routerWrapper.find(Link)).toHaveLength(2);
|
||||
expect(routerWrapper.find(MenuItem)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('renders buttons in the right nav of the submenu', () => {
|
||||
const mockFunc = jest.fn();
|
||||
const buttons = [
|
||||
{
|
||||
name: 'test_button',
|
||||
onClick: mockFunc,
|
||||
buttonStyle: 'primary',
|
||||
},
|
||||
{
|
||||
name: 'danger_button',
|
||||
buttonStyle: 'danger',
|
||||
},
|
||||
];
|
||||
const overrideProps = { buttons };
|
||||
const newWrapper = getWrapper(overrideProps);
|
||||
expect(newWrapper.find('.navbar-right').children()).toHaveLength(2);
|
||||
newWrapper.find('[buttonStyle="primary"]').simulate('click');
|
||||
expect(mockFunc).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user