mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Replace icons in dashboard and settings * Replace icons in alerting * Update batch of icons * Implement icons accross various files * Style updates * Search: Fix recent and starred icons * Update styling and details * Replace new icon created by unicons * Fix e2e test, styling * Minor styling updates Co-authored-by: Clarity-89 <homes89@ukr.net>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import PageHeader from './PageHeader';
|
|
import { shallow, ShallowWrapper } from 'enzyme';
|
|
|
|
describe('PageHeader', () => {
|
|
let wrapper: ShallowWrapper<PageHeader>;
|
|
|
|
describe('when the nav tree has a node with a title', () => {
|
|
beforeAll(() => {
|
|
const nav = {
|
|
main: {
|
|
icon: 'folder-open',
|
|
id: 'node',
|
|
subTitle: 'node subtitle',
|
|
url: '',
|
|
text: 'node',
|
|
},
|
|
node: {},
|
|
};
|
|
wrapper = shallow(<PageHeader model={nav as any} />);
|
|
});
|
|
|
|
it('should render the title', () => {
|
|
const title = wrapper.find('.page-header__title');
|
|
expect(title.text()).toBe('node');
|
|
});
|
|
});
|
|
|
|
describe('when the nav tree has a node with breadcrumbs and a title', () => {
|
|
beforeAll(() => {
|
|
const nav = {
|
|
main: {
|
|
icon: 'folder-open',
|
|
id: 'child',
|
|
subTitle: 'child subtitle',
|
|
url: '',
|
|
text: 'child',
|
|
breadcrumbs: [{ title: 'Parent', url: 'parentUrl' }],
|
|
},
|
|
node: {},
|
|
};
|
|
wrapper = shallow(<PageHeader model={nav as any} />);
|
|
});
|
|
|
|
it('should render the title with breadcrumbs first and then title last', () => {
|
|
const title = wrapper.find('.page-header__title');
|
|
expect(title.text()).toBe('Parent / child');
|
|
|
|
const parentLink = wrapper.find('.page-header__title > a.text-link');
|
|
expect(parentLink.prop('href')).toBe('parentUrl');
|
|
});
|
|
});
|
|
});
|