const ruleTester = require("../../ruletester"); import * as rule from "./drawerContent-replace-noBackground-colorVariant"; ruleTester.run("drawerContent-replace-noBackground-colorVariant", rule, { valid: [ { code: ``, }, { code: ``, }, { code: `import { DrawerContent } from '@patternfly/react-core'; `, }, { code: `import { DrawerContent, DrawerContentColorVariant } from '@patternfly/react-core'; `, }, { code: `import { DrawerContent } from '@patternfly/react-core'; `, }, { code: `import { DrawerContent } from '@patternfly/react-core'; `, }, ], invalid: [ { code: `import { DrawerContent } from '@patternfly/react-core'; `, output: `import { DrawerContent } from '@patternfly/react-core'; `, errors: [ { message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`, type: "JSXOpeningElement", }, ], }, { code: `import { DrawerContent } from '@patternfly/react-core'; `, output: `import { DrawerContent } from '@patternfly/react-core'; `, errors: [ { message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`, type: "JSXOpeningElement", }, ], }, { code: `import { DrawerContent } from '@patternfly/react-core'; const color = "no-background"; `, output: `import { DrawerContent } from '@patternfly/react-core'; const color = "no-background"; `, errors: [ { message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`, type: "JSXOpeningElement", }, ], }, { code: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; `, output: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; `, errors: [ { message: `The DrawerContentColorVariant enum should be used instead of the DrawerColorVariant enum when passed to the DrawerContent component. This fix will replace the colorVariant prop value with a string.`, type: "JSXOpeningElement", }, ], }, { code: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; `, output: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; `, errors: [ { message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`, type: "JSXOpeningElement", }, ], }, { code: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; const color = DrawerColorVariant.default; `, output: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; const color = DrawerColorVariant.default; `, errors: [ { message: `The DrawerContentColorVariant enum should be used instead of the DrawerColorVariant enum when passed to the DrawerContent component. This fix will replace the colorVariant prop value with a string.`, type: "JSXOpeningElement", }, ], }, { code: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; const color = DrawerColorVariant.noBackground; `, output: `import { DrawerContent, DrawerColorVariant } from '@patternfly/react-core'; const color = DrawerColorVariant.noBackground; `, errors: [ { message: `The "no-background" value of the \`colorVariant\` prop on DrawerContent has been removed.`, type: "JSXOpeningElement", }, ], }, ], });