Skip to content
Snippets Groups Projects
  • Romeo Van Snick's avatar
    b6bb9d18
    Allow creating new items by inserting comma in MultiAutocomplete (#42824) · b6bb9d18
    Romeo Van Snick authored
    
    * Pass current values to shouldCreate
    
    * Allow comma to create new item
    
    * Simplify getAvailableSelectItems
    
    * Add unit test for MultiAutocomplete input
    
    * Use text instead of Text in paste
    
    * Handle spaces in MultiAutocomplete
    
    * Remove cast
    
    * Reuse last var
    
    * Use haveLastBeenCalledWith over haveBeenCalledWith
    
    * Handle pasting when there is text in the input already
    
    * Accept quote-delimited values
    
    * Add info icon
    
    * Handle tab as a separator
    
    * Fix test cases for unsanitized parseValues
    
    * Add csv-parse
    
    * Use csv-parse to parse values
    
    * Apply the correct color to the info icon
    
    * Rename util to utils
    
    * Break up tooltip text
    
    * Only return unique values
    
    * Be more accepting around quotes in the middle of unescaped values
    
    * provide Buffer for csv-parse package in storybook
    
    * Use browser-friendly version of csv-parse
    
    * Remove unused eslint rule
    
    * Add specital case for csv-parse to jest config
    
    * Put uniqueness check in each state update
    
    * Only add partial value if it is valid
    
    * Only add partial value if it is valid
    
    * Fix test case for FilterValuePicker
    
    * Just use Set
    
    Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
    
    * Allow parsing more than one value
    
    * Use isValid everywhere it makes sense
    
    * Add test for RTL languages
    
    ---------
    
    Co-authored-by: default avatarAleksandr Lesnenko <alxnddr@gmail.com>
    Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
    Allow creating new items by inserting comma in MultiAutocomplete (#42824)
    Romeo Van Snick authored
    
    * Pass current values to shouldCreate
    
    * Allow comma to create new item
    
    * Simplify getAvailableSelectItems
    
    * Add unit test for MultiAutocomplete input
    
    * Use text instead of Text in paste
    
    * Handle spaces in MultiAutocomplete
    
    * Remove cast
    
    * Reuse last var
    
    * Use haveLastBeenCalledWith over haveBeenCalledWith
    
    * Handle pasting when there is text in the input already
    
    * Accept quote-delimited values
    
    * Add info icon
    
    * Handle tab as a separator
    
    * Fix test cases for unsanitized parseValues
    
    * Add csv-parse
    
    * Use csv-parse to parse values
    
    * Apply the correct color to the info icon
    
    * Rename util to utils
    
    * Break up tooltip text
    
    * Only return unique values
    
    * Be more accepting around quotes in the middle of unescaped values
    
    * provide Buffer for csv-parse package in storybook
    
    * Use browser-friendly version of csv-parse
    
    * Remove unused eslint rule
    
    * Add specital case for csv-parse to jest config
    
    * Put uniqueness check in each state update
    
    * Only add partial value if it is valid
    
    * Only add partial value if it is valid
    
    * Fix test case for FilterValuePicker
    
    * Just use Set
    
    Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
    
    * Allow parsing more than one value
    
    * Use isValid everywhere it makes sense
    
    * Add test for RTL languages
    
    ---------
    
    Co-authored-by: default avatarAleksandr Lesnenko <alxnddr@gmail.com>
    Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
jest.config.js 2.58 KiB
// @ts-check
/** @type {import('jest').Config} */
const config = {
  moduleNameMapper: {
    "\\.(css|less)$": "<rootDir>/frontend/test/__mocks__/styleMock.js",
    "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
      "<rootDir>/frontend/test/__mocks__/fileMock.js",
    "ace/ext-searchbox":
      "<rootDir>/frontend/test/__mocks__/aceSearchBoxExtMock.js",
    "^cljs/(.*)$": "<rootDir>/target/cljs_dev/$1",
    "^d3-(.*)$": "<rootDir>/node_modules/d3-$1/dist/d3-$1",
    "react-markdown":
      "<rootDir>/node_modules/react-markdown/react-markdown.min.js",
    "\\.svg\\?(component|source)":
      "<rootDir>/frontend/test/__mocks__/svgMock.jsx",
    "csv-parse/browser/esm/sync":
      "<rootDir>/node_modules/csv-parse/dist/cjs/sync",
  },
  transformIgnorePatterns: [
    "<rootDir>/node_modules/(?!(screenfull|echarts|zrender|rehype-external-links|hast.*|devlop|property-information|comma-separated-tokens|space-separated-tokens|vfile|vfile-message|html-void-elements|stringify-entities|character-entities-html4)/)",
  ],
  testPathIgnorePatterns: [
    "<rootDir>/frontend/.*/.*.tz.unit.spec.{js,jsx,ts,tsx}",
  ],
  testMatch: [
    "<rootDir>/**/*.unit.spec.js",
    "<rootDir>/**/*.unit.spec.{js,jsx,ts,tsx}",
  ],
  modulePaths: [
    "<rootDir>/frontend/test",
    "<rootDir>/frontend/src",
    "<rootDir>/enterprise/frontend/src",
  ],
  modulePathIgnorePatterns: ["<rootDir>/target/cljs_release/.*"],
  setupFiles: [
    "<rootDir>/frontend/test/jest-setup.js",
    "<rootDir>/frontend/test/metabase-bootstrap.js",
    "<rootDir>/frontend/test/register-visualizations.js",
  ],
  setupFilesAfterEnv: [
    "@testing-library/jest-dom",
    "<rootDir>/frontend/test/jest-setup-env.js",
  ],
  globals: {
    ace: {},
    ga: {},
  },
  reporters: ["default", "jest-junit"],
  coverageDirectory: "./coverage",
  coverageReporters: ["html", "lcov"],
  collectCoverageFrom: [
    "frontend/src/**/*.{js,jsx,ts,tsx}",
    "enterprise/frontend/src/**/*.{js,jsx,ts,tsx}",
    "!<rootDir>/**/*.styled.{js,jsx,ts,tsx}",
    "!<rootDir>/**/*.story.{js,jsx,ts,tsx}",
    "!<rootDir>/**/*.info.{js,jsx,ts,tsx}",
    "!<rootDir>/**/*.unit.spec.{js,jsx,ts,tsx}",
  ],
  coveragePathIgnorePatterns: [
    "/node_modules/",
    "/frontend/src/metabase/visualizations/lib/errors.js",
    "/target/cljs_dev/",
    "/target/cljs_release/",
    "/frontend/test/",
  ],
  testEnvironment: "jest-environment-jsdom",
  watchPlugins: [
    "jest-watch-typeahead/filename",
    "jest-watch-typeahead/testname",
  ],
  testTimeout: 30000,
};

// eslint-disable-next-line import/no-commonjs
module.exports = config;