The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/packages/grafana-eslint-rules/tests/no-aria-label-e2e-selectors...

49 lines
974 B

import { RuleTester } from 'eslint';
import noAriaLabelE2ESelector from '../rules/no-aria-label-e2e-selectors.cjs';
RuleTester.setDefaultConfig({
languageOptions: {
ecmaVersion: 2018,
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
});
const ruleTester = new RuleTester();
ruleTester.run('eslint no-aria-label-e2e-selector', noAriaLabelE2ESelector, {
valid: [
{
code: `<div aria-label="foo" />`,
},
{
code: `<div aria-label={"foo"} />`,
},
{
code: `
import { someOtherImport } from './some-other-location';
<div aria-label={someOtherImport} />
`,
},
],
invalid: [
{
code: `
import { selectors } from '@grafana/e2e-selectors';
<div aria-label={selectors.pages.AddDashboard.addNewPanel} />
`,
errors: [
{
message: 'Use data-testid for E2E selectors instead of aria-label',
},
],
},
],
});