-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make toolbar_button a shared component (#88386)
- Loading branch information
1 parent
2ae2692
commit fb536f5
Showing
12 changed files
with
292 additions
and
27 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
199 changes: 199 additions & 0 deletions
199
src/plugins/kibana_react/public/toolbar_button/__snapshots__/toolbar_button.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
export * from './toolbar_button'; |
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
47 changes: 47 additions & 0 deletions
47
src/plugins/kibana_react/public/toolbar_button/toolbar_button.test.tsx
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,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { ToolbarButton, POSITIONS, WEIGHTS, TOOLBAR_BUTTON_SIZES } from './toolbar_button'; | ||
|
||
const noop = () => {}; | ||
|
||
describe('sizes', () => { | ||
TOOLBAR_BUTTON_SIZES.forEach((size) => { | ||
test(`${size} is applied`, () => { | ||
const component = shallow(<ToolbarButton onClick={noop} size={size} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('positions', () => { | ||
POSITIONS.forEach((position) => { | ||
test(`${position} is applied`, () => { | ||
const component = shallow(<ToolbarButton onClick={noop} groupPosition={position} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('font weights', () => { | ||
WEIGHTS.forEach((weight) => { | ||
test(`${weight} is applied`, () => { | ||
const component = shallow(<ToolbarButton onClick={noop} fontWeight={weight} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('hasArrow', () => { | ||
it('is rendered', () => { | ||
const component = shallow(<ToolbarButton onClick={noop} hasArrow />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.