Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
illiteratewriter committed Mar 3, 2023
2 parents 8457b12 + 2695bfa commit 136fee3
Show file tree
Hide file tree
Showing 58 changed files with 4,353 additions and 8,047 deletions.
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ updates:
- dependency-name: raw-loader
versions:
- ">= 4.a, < 5"
- dependency-name: react-app-rewired
versions:
- ">= 2.a, < 3"
- dependency-name: react-helmet
versions:
- ">= 6.a, < 7"
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ jobs:
release-pr:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
- uses: GoogleCloudPlatform/release-please-action@v3
id: release-please
with:
token: ${{ secrets.REACTSTRAP_TOKEN }}
release-type: node
package-name: "reactstrap"
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"refactor","section":"Miscellaneous","hidden":false}]'
Expand All @@ -19,10 +18,9 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
token: ${{ secrets.REACTSTRAP_TOKEN }}
release-type: node
package-name: "reactstrap"
command: github-release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- run: rm -rf node_modules && yarn install --frozen-lockfile
- run: npm run lint
- run: npm run build --if-present
- run: npm test
- run: npm run test:ci
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,29 @@



## [9.1.6](https://github.com/reactstrap/reactstrap/compare/v9.1.5...v9.1.6) (2023-02-17)


### ⚠ BREAKING CHANGES

* add forwardRef to all components that contain innerRef

### Features

* add forwardRef to all components that contain innerRef ([17a141a](https://github.com/reactstrap/reactstrap/commit/17a141acbe9af558c1c3e7cb34fc051c1b1d8d0e))


### Bug Fixes

* convert functional components to be forwardRef components vs redefining them as such ([86578ab](https://github.com/reactstrap/reactstrap/commit/86578ab1f9e06653b03db06ed99263fba5e5e279))
* **Label:** migrate label to rtl ([#2665](https://github.com/reactstrap/reactstrap/issues/2665)) ([8c5cc2b](https://github.com/reactstrap/reactstrap/commit/8c5cc2bac0c219275896657db21f5c2ea5ecdffe))
* revert v10 merge ([3392ce9](https://github.com/reactstrap/reactstrap/commit/3392ce924ad304e97cede43ddef013a88ef84a6e))


### Miscellaneous

* release 9.1.6 ([f32f3d2](https://github.com/reactstrap/reactstrap/commit/f32f3d247b767592a80091e3f1733946b2f74ada))

### [9.1.5](https://www.github.com/reactstrap/reactstrap/compare/v9.1.4...v9.1.5) (2022-10-27)


Expand Down
5 changes: 5 additions & 0 deletions __mocks__/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"jest": true
}
}
10 changes: 7 additions & 3 deletions __mocks__/react-popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ export function Manager({ children }) {
return (children);
}

export function Popper({ children, placement }) {
return children({ ref: () => {}, placement, style: {}, arrowProps: { ref: () => {}, style: {} } });
}
export const Popper = jest.fn(({ children, placement }) => {
return children({
ref: () => {},
placement,
style: {},
arrowProps: { ref: () => {}, style: {} } });
})

export function Reference({ children }) {
return children({ ref: () => {} });
Expand Down
14 changes: 14 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = api => {
const isTest = api.env('test');
// TODO: Maybe use babel-preset env with browser targets and get rid of plugins
return {
"presets": isTest
? [['@babel/preset-env', {targets: {node: 'current'}}], "@babel/preset-react"]
: ["@babel/preset-react"],
"plugins": [
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-object-rest-spread"
]
};
};
195 changes: 195 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
/*
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/

export default {
// All imported modules in your tests should be mocked automatically
// automock: false,

// Stop running tests after `n` failures
// bail: 0,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/ch/whbczcbd64b_rz1r4sjy4t3h0000gp/T/jest_dy",

// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// Indicates which provider should be used to instrument code for coverage
// coverageProvider: "babel",

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,

// A path to a custom dependency extractor
// dependencyExtractor: undefined,

// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,

// The default configuration for fake timers
// fakeTimers: {
// "enableGlobally": false
// },

// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,

// A set of global variables that need to be available in all test environments
// globals: {},

// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "mjs",
// "cjs",
// "jsx",
// "ts",
// "tsx",
// "json",
// "node"
// ],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],

// Activates notifications for test results
// notify: false,

// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
// preset: undefined,

// Run tests from one or more projects
// projects: undefined,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,

// Automatically reset mock state before every test
// resetMocks: false,

// Reset the module registry before running each individual test
// resetModules: false,

// A path to a custom resolver
// resolver: undefined,

// Automatically restore mock state and implementation before every test
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,

// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
setupFiles: ['./src/setupTests.js'],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: "jsdom",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],

// This option allows the use of a custom results processor
// testResultsProcessor: undefined,

// This option allows use of a custom test runner
// testRunner: "jest-circus/runner",

// A map from regular expressions to paths to transformers
// transform: undefined,

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: undefined,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
};
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactstrap",
"version": "9.1.5",
"version": "9.1.6",
"description": "React Bootstrap components",
"type": "module",
"source": "src/index.js",
Expand All @@ -16,8 +16,9 @@
"esnext": "src/index.js",
"sideEffects": false,
"scripts": {
"test": "cross-env SKIP_PREFLIGHT_CHECK=true react-app-rewired test --env=jsdom",
"cover": "npm test -- --coverage",
"test": "jest --watch",
"test:ci": "jest",
"cover": "jest --coverage",
"start": "start-storybook -s ./static -p 8080",
"build:docs": "build-storybook -s ./static -o ./build",
"build": "microbundle --generateTypes false --jsx React.createElement --compress false",
Expand Down Expand Up @@ -272,11 +273,12 @@
"react-dom": ">=16.8.0"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/core": "^7.20.2",
"@babel/eslint-parser": "^7.18.2",
"@babel/plugin-proposal-export-default-from": "^7.12.1",
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.12.10",
"@storybook/addon-actions": "^6.3.7",
"@storybook/addon-essentials": "^6.3.7",
Expand All @@ -288,6 +290,7 @@
"@testing-library/user-event": "13.5.0",
"@types/react": "^16.9.51",
"babel-eslint": "^9.0.0",
"babel-jest": "28.1.3",
"babel-loader": "^8.2.2",
"babel-preset-react-app": "^10.0.1",
"bootstrap": "^5.1.0",
Expand All @@ -308,16 +311,17 @@
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-storybook": "^0.6.1",
"holderjs": "^2.9.3",
"jest": "28.1.3",
"jest-environment-jsdom": "28.1.3",
"jsdom": "^19.0.0",
"json-loader": "^0.5.7",
"microbundle": "^0.13.3",
"prettier": "2.7.1",
"react": "^16.8.0",
"react-app-rewired": "^1.6.2",
"react-dom": "^16.3.2",
"react-helmet": "^5.0.3",
"react-prism": "^4.3.2",
"react-router": "^3.2.1",
"react-scripts": "2.1.1",
"react-test-renderer": "^16.3.2",
"typescript": "^4.0.3",
"webpack": "^4.43.0"
Expand Down
6 changes: 3 additions & 3 deletions src/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Dropdown extends React.Component {
const menu = this.getMenu();
const toggle = this.getToggle();

const targetIsToggle = e.target === toggle;
const targetIsToggle = toggle.contains(e.target);
const clickIsInMenu = menu && menu.contains(e.target) && menu !== e.target;

let clickIsInInput = false;
Expand Down Expand Up @@ -154,13 +154,13 @@ class Dropdown extends React.Component {
if (!this.props.isOpen) {
this.toggle(e);
}
setTimeout(() => this.getMenuItems()[0].focus());
setTimeout(() => this.getMenuItems()[0]?.focus());
} else if (this.props.isOpen && isTab) {
// Focus the first menu item if tabbing from an open menu. We need this
// for cases where the DropdownMenu sets a custom container, which may
// not be the natural next item to tab to from the DropdownToggle.
e.preventDefault();
this.getMenuItems()[0].focus();
this.getMenuItems()[0]?.focus();
} else if (this.props.isOpen && e.which === keyCodes.esc) {
this.toggle(e);
}
Expand Down

0 comments on commit 136fee3

Please sign in to comment.