mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-20 18:23:05 -08:00
e0443e6fa3
* Add MetricFormat unit tests Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add App unit tests; Add debug script Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add Checkbox unit tests Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add SeriesName unit tests Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add QueryStatsView unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add Legend unit tests Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Remove unused utils/func Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add utils/urlParams unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add utils/timeFormat unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add ExpressionInput unit tests Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add GraphControls unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add TimeInput unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add DataTable unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add SanitizeHTML unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add Graph unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Extract utils/html Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add PanelList unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add Panel unit test Signed-off-by: Dustin Hooten <dhooten@splunk.com> * Add react-ui test coverage report to CI Signed-off-by: Dustin Hooten <dhooten@splunk.com>
26 lines
825 B
TypeScript
26 lines
825 B
TypeScript
import * as React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import SanitizeHTML from '.';
|
|
|
|
describe('SanitizeHTML', () => {
|
|
it(`renders allowed html`, () => {
|
|
const props = {
|
|
allowedTags: ['strong'],
|
|
};
|
|
const html = shallow(<SanitizeHTML {...props}>{'<strong>text</strong>'}</SanitizeHTML>);
|
|
const elem = html.find('div');
|
|
expect(elem).toHaveLength(1);
|
|
expect(elem.html()).toEqual(`<div><strong>text</strong></div>`);
|
|
});
|
|
|
|
it('does not render disallowed tags', () => {
|
|
const props = {
|
|
tag: 'span' as keyof JSX.IntrinsicElements,
|
|
allowedTags: ['strong'],
|
|
};
|
|
const html = shallow(<SanitizeHTML {...props}>{'<a href="www.example.com">link</a>'}</SanitizeHTML>);
|
|
const elem = html.find('span');
|
|
expect(elem.html()).toEqual('<span>link</span>');
|
|
});
|
|
});
|