debian-mirror-gitlab/spec/frontend/behaviors/markdown/render_gfm_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1,006 B
JavaScript
Raw Normal View History

2023-03-17 16:20:25 +05:30
import { renderGFM } from '~/behaviors/markdown/render_gfm';
2023-07-09 08:55:56 +05:30
import renderMetrics from '~/behaviors/markdown/render_metrics';
jest.mock('~/behaviors/markdown/render_metrics');
2023-03-17 16:20:25 +05:30
describe('renderGFM', () => {
it('handles a missing element', () => {
expect(() => {
renderGFM();
}).not.toThrow();
});
2023-07-09 08:55:56 +05:30
describe('remove_monitor_metrics flag', () => {
let metricsElement;
beforeEach(() => {
window.gon = { features: { removeMonitorMetrics: true } };
metricsElement = document.createElement('div');
metricsElement.setAttribute('class', '.js-render-metrics');
});
it('renders metrics when the flag is disabled', () => {
window.gon.features = { features: { removeMonitorMetrics: false } };
renderGFM(metricsElement);
expect(renderMetrics).toHaveBeenCalled();
});
it('does not render metrics when the flag is enabled', () => {
renderGFM(metricsElement);
expect(renderMetrics).not.toHaveBeenCalled();
});
});
2023-03-17 16:20:25 +05:30
});