aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/util
AgeCommit message (Collapse)AuthorFilesLines
2024-07-19Fix `this` reference for JavaScript functions (#38725)Nathan Sarang-Walters1-2/+2
2023-05-01Update URL sanitizer to allow more protocols (#38531)Kyle Tsang1-10/+68
Co-authored-by: XhmikosR <[email protected]>
2023-03-29Tweak and re-organize ESLint config (#38369)XhmikosR9-27/+25
* Tweak and re-organize ESLint config * merge individual configs to the root config * enable more eslint-plugin-import rules * lint markdown files * Lint
2022-11-12ESLint: enable prefer-template rule (#37484)XhmikosR1-1/+1
2022-11-06Move `getElementFromSelector` & `getSelectorFromElement` to SelectorEngine ↵GeoSot1-113/+0
(#36027) * Move `getElementFromSelector` & getSelectorFromElement` inside selector-engine.js, in order to use SelectorEngine methods, avoiding raw querySelector usage * add `getMultipleElementsFromSelector` helper Co-authored-by: Julien Déramond <[email protected]>
2022-10-07Boost `execute` function, being able to handle arguments (#36652)GeoSot1-0/+19
2022-07-04ref(tests): Minor fix to use self-closing input HTML tag (#36667)Julien Déramond1-3/+3
2022-05-31JS: tests fixes & standardization of spies usage (#36398)Louis-Maxime Piton5-34/+34
* Fix carousel spec typo * Change carousel test name in align with testing method * Make the spies declarations the same everywhere
2022-04-21Manipulator: Add JSON parse support (#35077)GeoSot1-0/+88
Support parsing JSON from each component's main element using the `data-bs-config` attribute. The `bs-config` attribute will be reserved and omitted during `getDataAttributes` parsing. With this commit, every component, will create its config object, using: * defaults * data-bs-config * the rest of data attributes * configuration object given during instance initialization Co-authored-by: XhmikosR <[email protected]> Co-authored-by: Mark Otto <[email protected]> Co-authored-by: Mark Otto <[email protected]>
2022-02-15Update devDependencies (#35841)XhmikosR2-5/+5
* Update devDependencies * @babel/core ^7.17.0 → ^7.17.2 * @rollup/plugin-replace ^3.0.1 → ^3.1.0 * eslint ^8.8.0 → ^8.9.0 * eslint-config-xo ^0.39.0 → ^0.40.0 * hugo-bin ^0.80.1 → ^0.80.2 * karma ^6.3.15 → ^6.3.16 * rollup ^2.67.1 → ^2.67.2 * Fix new ESLint errors
2022-01-30tests: replace 'done' callback with 'Promise' to fix deprecation errors (#35659)GeoSot5-495/+551
Reference: https://jasmine.github.io/tutorials/async 'DEPRECATION: An asynchronous function called its 'done' callback more than once. This is a bug in the spec, beforeAll, beforeEach, afterAll, or afterEach function in question. This will be treated as an error in a future version. See<https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#deprecations-due-to-calling-done-multiple-times> for more information.
2022-01-30Event handler: replace deprecated `initEvent`GeoSot1-2/+1
2022-01-13Fix: `isVisible` function behavior in case of a `<details>` element, on ↵Ryan Berliner1-0/+36
chrome 97 (#35682)
2021-12-10Extract Component config functionality to a separate class (#33872)GeoSot2-47/+78
Co-authored-by: XhmikosR <[email protected]>
2021-12-09Fix tests fixture type (#35501)XhmikosR1-10/+8
Previously we were adding an Array instead of a String
2021-12-09ScrollBar.js. Minor refactoring and add test (#35492)GeoSot1-0/+21
2021-12-01tests/unit/util/scrollbar.spec.js: rename functionXhmikosR1-6/+6
`parseInt` is a global one.
2021-12-01tests: fix a few typosXhmikosR1-13/+13
2021-12-01tests: remove extra spaces, unneeded arrays and add missing newlinesXhmikosR7-59/+51
2021-12-01tests: tweak Jasmine's matchers usageXhmikosR5-106/+106
Use: * toBeNull * toEqual * toBeTrue * toBeFalse * toHaveSize * toHaveClass
2021-11-25Add a template factory helper to handle all template cases (#34519)GeoSot1-0/+305
Co-authored-by: XhmikosR <[email protected]>
2021-10-13tests: try to fix a few random failures (#35184)GeoSot1-4/+3
* Change `Swipe` dispose spy on EventHandler * Modal hide spy on backdrop hide
2021-10-12Swipe: add test to ensure that it ignores `pinch` events (#35161)GeoSot1-0/+19
2021-10-11Extract Carousel's swipe functionality to a separate Class (#32999)GeoSot1-0/+263
2021-10-08tests: minor cleanup (#35138)XhmikosR1-2/+0
* tests: minor cleanup * tests: use the util noop function
2021-10-07Sanitizer: fix logic and add a test. (#35133)XhmikosR1-0/+25
This was broken in 2596c97 inadvertently. Added a test so that we don't hit this in the future.
2021-10-05Enable `unicorn/no-array-for-each` ruleXhmikosR1-6/+8
2021-09-07Typo fixes (#34914)XhmikosR1-1/+1
2021-07-30Enable a few eslint-config-xo rules (#34620)XhmikosR1-2/+2
* unicorn/prefer-dom-node-append * unicorn/prefer-dom-node-remove
2021-07-28Use a streamlined way to trigger component dismiss (#34170)GeoSot1-0/+108
* use a streamlined way to trigger component dismiss * add documentation Co-authored-by: XhmikosR <[email protected]>
2021-07-27Add shift-tab keyboard support for dialogs (modal & Offcanvas components) ↵Ryan Berliner1-0/+210
(#33865) * consolidate dialog focus trap logic * add shift-tab support to focustrap * remove redundant null check of trap element Co-authored-by: GeoSot <[email protected]> * remove area support forom focusableChildren * fix no expectations warning in focustrap tests Co-authored-by: GeoSot <[email protected]> Co-authored-by: XhmikosR <[email protected]>
2021-07-20Fix `Util.reflow` function and add documentation (#34543)GeoSot1-2/+3
* add documentation to reflow function * refactor to void as it should be Co-authored-by: XhmikosR <[email protected]>
2021-06-25Variablize backdrop for modal and offcanvasMark Otto1-34/+50
2021-06-22Register only one `DOMContentLoaded` event listener in `onDOMContentLoaded` ↵alpadev1-2/+11
(#34158) * refactor: reuse one DOMContentLoaded event listener in onDOMContentLoaded function Instead of adding an event listener everytime the utility function is called, cache the callbacks and execute them all at once. * refactor: drop iife for onDOMContentLoaded Co-authored-by: XhmikosR <[email protected]>
2021-06-06Refactor scrollbar.js to be used as a Class (#33947)GeoSot1-32/+41
2021-06-03Fix handling of transitionend events dispatched by nested elements(#33845)alpadev1-29/+124
Fix handling of transitionend events dispatched by nested elements Properly handle events from nested elements Change `emulateTransitionEnd` to `executeAfterTransition` &&
2021-05-31Changing Backdrop rootElement to default to a string (#34092)Ryan Weaver1-2/+2
The current config can cause the "body" to become stale. Specifically, if the entire body element is swapped out for a new body element, then the backdrop will continue to append itself to the original body element, since it's stored in memory as a reference on this object. This also no longer allows an explicit null to be passed to Backdrop's rootElement This still accomplishes the laziness of "not finding the rootElement until the Backdrop is created" to avoid problems of the JavaScript being included inside <head> (so, before body is available).
2021-05-22Automatically select an item in the dropdown when using arrow keys (#34052)alpadev1-1/+12
2021-05-22fix test of #34014 (#34070)GeoSot1-14/+16
Fixes regression of https://github.com/twbs/bootstrap/commit/a2b5901efc6de12bb828f8dda118ddccbcd545cf breaking the test runner because it would wipe document.body.
2021-05-22Fix bug where backdrop calls method on null if it is already removed from ↵Ryan Weaver1-0/+19
the body (#34014) Co-authored-by: Rohit Sharma <[email protected]>
2021-05-20Refactor `isVisible` helper, fixing false positives from deep nesting or ↵Ryan Berliner1-2/+50
alternate means (#33960)
2021-05-20Add Tests on scrollbar.js & better handling if a style property doesn't ↵GeoSot1-36/+119
exists (#33948) * scrollbar.js: add some tests transfer test from modal.spec. to scrollbar.spec proper handling if style property doesn't exist
2021-05-19Add `getNextActiveElement` helper function to utils, replacing custom ↵GeoSot1-0/+39
implementation through components (#33608)
2021-05-13Move get element functionality to a helper (#33327)GeoSot1-9/+43
Looking around on js components I found out many checks, different expressed but with same purpose. Some of them are trying to parse string to element, others, jQuery element to js simple nodeElement etc With this Pr, I am trying to give a standard way to parse an element So this pr: * Creates `getElement` helper that tries to parse an argument to element or null * Changes `isElement` to make explicit checks and return Boolean * fixes tests deficiencies
2021-05-11Extract static `DATA_KEY` & `EVENT_KEY` to base-component (#33635)GeoSot1-1/+2
* Force each plugin that extends base-components to implement a static method `NAME()` * Remove redundant `NAME` argument from 'Utils.defineJQueryPlugin' & fix test
2021-05-10Fix backdrop `rootElement` not initialized in Modal (#33853)Nagarjun Bodduna1-29/+43
* Initialize default value of rootElement before using * Remove redundant test | put rootElement tests together Co-authored-by: GeoSot <[email protected]>
2021-04-25Scrollbar: respect the initial body overflow value (#33706)GeoSot1-7/+84
* add method to handle overflow on body element & tests * replace duplicated code on modal/offcanvas tests
2021-04-19Use the backdrop util in offcanvas, enforcing consistency (#33545)GeoSot1-0/+25
* respect /share modal's backdrop functionality, keeping consistency * listen click events over backdrop (only) and trigger `hide()` without add/remove event tricks * achieve to hide foreign open offcanvas instances without glitches `if (allReadyOpen && allReadyOpen !== target)`, in case another is going to be open, when user clicks on trigger button
2021-04-14Decouple BackDrop from modal (#32439)GeoSot2-0/+224
* Create backdrop.js util * revert breaking changes remove PromiseTimout usage revert class name * one more test | change bundlewatch.config * add config obj to backdrop helper | tests for rootElement | use transitionend helper * Minor tweaks — Renaming Co-authored-by: Rohit Sharma <[email protected]>
2021-04-14Js: fix some testsGeoSot1-2/+4