Skip to content

Commit

Permalink
FIO-8548: Upgrade to 11 version (#3)
Browse files Browse the repository at this point in the history
* Fix coverage report

* Compile JS files

* Update playwright test name

* Disable large set of tests, and increase workers since workers ahve 2 cores

* Fix unit tests

* Fix test:e2e/test:e2e:all not starting the webserver

* Fix incorrect label[for] attributes in tests

* Add aria-label as required from the label[for] which points at an element. A config.labelId overrides this

* JSDOM support 'ch' character widths

* Fix unit tests no supplying the template renderer with the context they are expecting

* Move code around to remind the reduce dependencies between templates.ts and choices.ts. Fix overriding some notice templates didn't work

* Correctly setup templates

* Compile JS files

* Run e2e tests on local host and not a fixed ipv4

* Fix wrong key for caching playwright data & reduce e2e test log spam

* Fix extracting playright version

* Adjust timeouts

* Adjust caching checks

* Adjust caching checks

* Adjust caching checks

* Adjust gitflow actions for consistency

* update workflow

* Ignore intelij per-project test execution configuration directory

* Use playwright to start a background server for tests, saves possible race on compiling types-script

* intelij expects playwright test file to import from '@playwright/test' when determining what test suite to execute a test from the gutter

* Update tests

* Convert select-multiple element tests, match all tests on the page

* Update destroy/re-init tests

* Update various tests to reduce false positives

* Fix edge case where the max item notice didn't render as expected (text/select-multiple)

* Byte shaving

* Split _canAddItems and _canCreateItems into separate functions, fix input limit didn't show it's notice and text elements would show a choices list

* Chore; tighten up usage of isScrolledIntoView and return type of getAdjacentEl

* Use querySelector<HTMLElement>/querySelectorAll<HTMLElement> to type hint the return type as expected

* Compile JS files

* Byte-shave

* Update tests to check rendering of dropdown item

* Allow choices.js to be imported on nodejs, useful for tests and also server side rendering. As windows.document is by default not defined, the default template rendering will not function. The `callbackOnCreateTemplates` callback must be used. Choices-js#861

* Prefix build flags with CHOICES_, setup canUseDom to be setable via enviromental variables

* Notices are trusted and any user data is escaped, simplify notice rendering code, and fix inconsistency in rendering the "press enter to add X" notice.

* Fix remote data e2e test

* Do not hide the input as this disables rendering the placeholder

* Compile JS files, reduce build size as .mjs users should be doing their own tree-shaking/minifying

* Update CHANGELOG.md

* Replace puppeteer/selenium screenshots with playwright

* Enable playwright for additional platforms

* Test github action e2e tests

* Force the dev server to execute during CI when WATCH_HOST is defined

* Remove old web server used during CI

* Force must be a bool

* Fix edge case where aria-label could be added twice

* Allow searchResultLimit to specific no limit

* Remove redundant variable set

* Reduce the number of loops over choices when rendering search results, results in more compact code.

* Compile JS files

* reduce strictness of closeDropdownOnSelect validation

* Update the URL used in e2e tests

* Adjust e2e tests

* Only run a single work on CI to avoid starving the CPU for the browser

* Also export a json report for the e2e test

* Work on all test targets

* Update github action cache logic

* Only archive test reports if the github action isn't canceled

* Use blob report and then merge all the reports together

* Update screenshots

* Disable caching playwright binaries on windows

* Run separate github action for each browser

* Just give-up on binary caching as it causes issues

* Make remote loading tests less flaky

* Fix select-multiple 'checking placeholder values' test

* Use line reporter for development mode e2e testing

* Block polyfill URLs since they aren't needed with latest browsers

* Use a HAR files to mock the external API to avoid token API usages from breaking the test

* webkit and firefox are bizarrely flaky

* Correctly format excludes

* Remove github reporter on trying to troubleshoot the lack of merged report

* Split optional argument for expectVisibleDropdown into new test function

* Remove usage of Object.assign to reduce minified bundle size (assigning to a local variable is paradoxically smaller)

* For performance, use a document fragment when adding new choices to the backing `<select>`

* Inline append method

* Centralize build flags

* Compile JS files

* Simplify Templates interface

* Byte shaving by hoisting variables which are used more than once (inlining when they aren't) and some code deduplication

* Byte shaving, and be consistant about how innerHTML is used

* Trigger a search event when search stops

* Update CHANGELOG.md

* Fix the page scrolls when you press 'space' on a single select input Choices-js#1103

* Update CHANGELOG.md

* Make demo page screenshot test less flaky

* Compile JS files

* Update typescript definition for `removeActiveItems` to explicitly mark `excludedId` as optional Choices-js#1116

* Update e2e test to be run

* Update build-and-test github action

* Update deployment/publish action

* Tweak package.json for e2e tests

* Update build-and-test github action

* Update trigger conditions for various workflows

* 11.0.0-rc8

* Remove unused package.json action

* Re-use github actions on push to main

* Add sponsored by block

* Adjust logo size

* Remove non-required build flag usage

* In _onKeyDown, Inline a few variables which are only used once

* If itemSelectText is an empty string, do not reserve space for the "press to select" text phrase. Resolves Choices-js#820

* Reduce work done for unhighlightAll during on-click handler (batch handler in v11.0.0-rc8 would also have helped) Choices-js#522 Choices-js#599

* Performance tests with thousands of items selected

* Inline highlightItem/unhighlightItem to avoid quadratic complexity

* Switch from string literal type to effectively valueOf<EventType> to intern strings

* Update tests to permit newer target versions (main source tree still targets ES5)

* Fix fragile highlightall/unhighlightall tests

* Dramatically reduce the performance impact of changing items (avoid re-rendering all items on every change)

* Support item rendering latching onto pre-rendered items

* Handle case where the element needs to be regenerated

* Fix placeholder not applying as expected for select-one when loading items

* Push highlight css toggle into reducer, simplifying state tracking

* Avoid touching every item after an item is added, instead call unhighlightall as required

* Simplify _onBlur & _onFocus

* Adjust unhighlightAll to generally be called in a _store.withTxn to reduce redundnant rendering passes

* Hoist variables to reduce bundle size

* Preserve choices associated with groups

* Inline renderChoice functionality & cleanup duplication

* Cache element/group to reduce rendering time

* Avoid reflows by using display: none; vs visibility: hidden;

* Remove overly fragile unit testing of rendering

* Restore older placeholder rendering behavior

* Fix dropdown flip logic did not consider verticality of both sides of the dropdown (ref: #2)

* Update e2e tests

* linting fixes

* Adjust when the choice's cached element is purged

* Simplify groupId check, and push group label rendering into template

* Use Element.replaceChildren API, update polyfill definition

* Compile JS files

* Disable unusably slow test

* Commit linter fixes

* cleanup css

* Remove unused eslint disable

* Add ValueOf utility type

* Use const object instead of loose constants for text/select-one/select-multiple

* Allow renderSelectedChoices to be a direct boolean to simplify internal logic

* Add e2e test for renderSelectedChoices flag

* Invalidate cached choice when an item is added/removed & fix renderSelectedChoices === 'always' with select-multiple

* Revert & add some variable hoisting as it compressed better

* Cleanup unused function and redundant variable assignment

* Update  tests

* Compile JS files

* Cleanup unused import

* Commit lint fixed file

* Update CHANGELOG.md

* Cleanup appending group label to choices

* Appease linter

* release prep

* Update bug_report.md

* Avoid iterating the active choices list multiple times

* Add e2e test for reset button

* Fix refresh() did not reset the backing select's options attributes when "deselectAll" argument was true

Fix clearStore() did not remove selected item from the items list

* Compile JS files

* Fix unit test & e2e test

* Update CHANGELOG.md

* Force merge reports

* Adjust e2e testing matrix

* Additional e2e tests for copy & paste support

* Add serialization locks around copy/paste to workaround a lack of clipboard isolation

* Additional paste & search tests

* Ensure timers can trigger for copy & paste tests

* Rewrite e2e paste to avoid javascript APIs

* Linting fix

* Revert "Adjust e2e testing matrix"

This reverts commit 1ba4f81.

* Update CHANGELOG.md

* Use helper function for add/remove classes, standardize adding/setting classnames for elements. Also shaves ~180 bytes off the compressed bundle

* Release prep

* Adjust github actions to work on main branch instead of master branch

* Update pages deployment to use node 20, and update various actions to no longer use out of date node versions

* Chore: add e2e tests for "no choices" behavior to match v10

* Add missing 'multiple' attribute to "no press to select" test

* Move comment around disabled/selected/active flags from reducer to the choice object

* Fix choice disable state wasn't considered when showing the "no choices to choose from" notice

* Document previous pre-v10 behavior of noChoicesText

* Adjust "within form" tests to have a 2nd selectable item to avoid no choices exist notice

* Fix regression "no choices to choose from" notice not triggering when no selectable choices exist for select-one. [Choices-js#1185](Choices-js#1185)

* Tests for no choices besides the current selected

* Byte shaving _initStore method

* Compile JS files

* Pass `getClassNames` as the 3rd argument to `callbackOnCreateTemplates` callback

* Suppress import cycle between templates/options

* Add missing webpack exports

Add some entries to `package.json` to improve compatibility with webpack

- Add default `style` and `sass` exports as per webpack requirements
- Add `public/assets/styles/*` exports for CSS files
- Add `src/styles/*` exports for Scss files. Extension can be omitted
  to prevent linting issues with `stylelint`
- Add `*.scss` and `*.css` to "side effects" to prevent issues with
  tree-shaking

With this commit, it is possible to import styles with the same syntax
of v10 to prevent a breaking change in webpack based applications

Refs:
- https://webpack.js.org/guides/package-exports/
- https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-import-partial-extension/README.md

Close Choices-js#1184

* Update CHANGELOG.md

* Update e2e tests - add search and then remove search for displaying expected banners

* Cleanup notice display on no results vs no choices

* Reset notices after adding a new choice

* Adjust additional notice reset calls

* Adjust CHANGELOG.md

* Fix regression of UnhighlightItem event not firing (Choices-js#1173)

* Fix unit tests testing the wrong thing

* Compile JS files

* Fix "no choices' notice wasn't cleared as expected

* Untangle clearStore and clearChoices

- Fix `clearChoices()` would also remove items, and clearing the search flag.
- Fix `clearStore()` was wiping options

* Fix unit test

* `duplicateItemsAllowed` option is now respected by `setChoices()` method. Resolves Choices-js#855

* Commit clearStore change

* Document clearStore and clearChoices on if they reset the search state

* Update CHANGELOG.md

* Add autocomplete example to e2e test

* Add flag to setChoices on if to reset the search flag (default true)

* Compile JS files

* De-dupe type, and remove broad @typescript-eslint/no-explicit-any lint suppression

* _getChoiceForOutput never gets an undefined value

* Fix typing for getValue, which removes the need for eslint-disable @typescript-eslint/no-explicit-any

* Fix refresh() did not work properly with opt-groups

* Fix missing tag in e2e test html

* Fix group-id was not added to choices outside of search

* Fix opt-group e2e tests false positive

* Use group reference instead of groupId

* Fix removing a choice didn't work properly when it was part of a group

* Fix regression of choices without groups where not rendered when groups where present

* cleanup tests

* Use parentElement not parentNode, and cleanup arguments which will not have undefined passed to them

* Adjust timeouts for e2e CI

* Compile JS files

* Bump vite from 5.3.5 to 5.4.6

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.3.5 to 5.4.6.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.6/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.6/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump rollup from 4.20.0 to 4.22.4

Bumps [rollup](https://github.com/rollup/rollup) from 4.20.0 to 4.22.4.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](rollup/rollup@v4.20.0...v4.22.4)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* version bump

* Replace enum with {} as const (compiles down to the same minified code)

* Compile JS files

* Be explicit about type argument being passed to mapInputToChoice

* Fix input text - method setValue Choices-js#1207

* Update E2E tests

* Remove unused e2e tests

* Update E2E tests

* Update e2e tests to upload failed screenshots if multiple for the same platform fail

* Update E2E tests

* Update v11 event payload in README.md

* removed type "module" from package.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Xon <635541+Xon@users.noreply.github.com>
Co-authored-by: Xon <Xon@users.noreply.github.com>
Co-authored-by: Geremia Taglialatela <tagliala.dev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Darren <DarrenOnce@gmail.com>
  • Loading branch information
6 people authored Jan 13, 2025
1 parent f4e2b55 commit 9d0fe09
Show file tree
Hide file tree
Showing 356 changed files with 52,566 additions and 25,035 deletions.
17 changes: 0 additions & 17 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

49 changes: 27 additions & 22 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
],
"env": {
"es6": true,
"browser": true,
"mocha": true,
"cypress/globals": true
"node": true,
"browser": true
},
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
"sourceType": "module",
"project": true
},
"rules": {
"no-param-reassign": ["error", { "props": false }],
"@typescript-eslint/explicit-function-return-type": "error",
"import/no-named-as-default": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": [
"error",
Expand Down Expand Up @@ -62,16 +64,27 @@
}
],
"lines-between-class-members": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-namespace": "off",
"react/jsx-filename-extension": [0]
"react/jsx-filename-extension": [0],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"mjs": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
]
},
"overrides": [
{
"files": ["*.test.ts"],
"env": {
"mocha": true
},
"files": ["*.test.ts", "*.spec.ts"],
"rules": {
"no-await-in-loop": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"no-restricted-syntax": "off",
"compat/compat": "off",
"no-new": "off",
Expand All @@ -88,16 +101,6 @@
}
]
}
},
{
"files": ["cypress/**"],
"plugins": ["cypress"],
"rules": {
"no-unused-vars": "warn"
},
"env": {
"cypress/globals": true
}
}
],
"settings": {
Expand All @@ -112,12 +115,14 @@
"CustomEvent",
"Element.prototype.classList",
"Element.prototype.closest",
"Element.prototype.dataset"
"Element.prototype.dataset",
"Element.prototype.replaceChildren"
],
"import/resolver": {
"node": {
"extensions": [".js", ".ts"]
}
}
}
},
"ignorePatterns": ["node_modules/*", "public/*"]
}
15 changes: 15 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# byte shaving (hoist semi-commonly variables, remove some low level low-usage functions)
157a47a44a01e3ce4b54ad211b1756ff59985bef
5bee41d7ff08e05442b232e3e552dcb6c703568d
e9382df0ae63edfc7540f82f74cf969342c759c0

# prettier config change
00433d200d8cccc8b544fbc8f05d5e96bf8ccff7

# misc linting cleanup
00009d2effa8b41a6ce27ef8b06a35a04215aea6
62b786d1f13d0934137a62909d3a37db0a3e927e
5ad61841143508c9f91f0edd57f81f8b11066e0a
84a61cad1ddab1e851c98efa619a2cd35af434c1
33f573247e8badc9ee10defe326f13985342e09b
b0199538a82d49de429f35546e412d14fc8bfeb9
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.

**Choices version and bundle**
- Version: [e.g. v11.0.0 choices.min.js]

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
Expand Down
Binary file not shown.
Binary file removed .github/actions-scripts/__snapshots__/edge-win32.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .github/actions-scripts/__snapshots__/ie-win32.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
92 changes: 0 additions & 92 deletions .github/actions-scripts/puppeteer.js

This file was deleted.

155 changes: 0 additions & 155 deletions .github/actions-scripts/selenium.js

This file was deleted.

Loading

0 comments on commit 9d0fe09

Please sign in to comment.