Commit Graph

33 Commits

Author SHA1 Message Date
Nathan Sarang-Walters 16d80a4ff7
Fix `this` reference for JavaScript functions (#38725) 2024-07-19 07:05:21 +02:00
XhmikosR ae43f0c48b
Tweak and re-organize ESLint config (#38369)
* Tweak and re-organize ESLint config

* merge individual configs to the root config
* enable more eslint-plugin-import rules
* lint markdown files

* Lint
2023-03-29 13:49:30 -04:00
GeoSot e81e7cda90
Move `getElementFromSelector` & `getSelectorFromElement` to SelectorEngine (#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 <juderamond@gmail.com>
2022-11-06 20:31:43 +02:00
GeoSot 4cb046a6b8
Boost `execute` function, being able to handle arguments (#36652) 2022-10-07 15:25:00 +03:00
Julien Déramond c1813ef2bc
ref(tests): Minor fix to use self-closing input HTML tag (#36667) 2022-07-04 14:12:10 +03:00
Louis-Maxime Piton d388bd6e1b
JS: tests fixes & standardization of spies usage (#36398)
* Fix carousel spec typo
* Change carousel test name in align with testing method
* Make the spies declarations the same everywhere
2022-05-31 11:18:32 +03:00
GeoSot aa650f0f1e
tests: replace 'done' callback with 'Promise' to fix deprecation errors (#35659)
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-30 14:30:04 +02:00
Ryan Berliner 14c7dc1e88
Fix: `isVisible` function behavior in case of a `<details>` element, on chrome 97 (#35682) 2022-01-13 10:55:05 +02:00
GeoSot 886b940796
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-10 18:18:18 +02:00
XhmikosR 94d4fa3b10
Fix tests fixture type (#35501)
Previously we were adding an Array instead of a String
2021-12-09 16:01:29 +02:00
XhmikosR f8f9dc3b5c tests: remove extra spaces, unneeded arrays and add missing newlines 2021-12-01 14:30:49 +02:00
XhmikosR eb54e1a1ce tests: tweak Jasmine's matchers usage
Use:

* toBeNull
* toEqual
* toBeTrue
* toBeFalse
* toHaveSize
* toHaveClass
2021-12-01 14:30:49 +02:00
XhmikosR a260967a55
tests: minor cleanup (#35138)
* tests: minor cleanup

* tests: use the util noop function
2021-10-08 12:32:11 +03:00
GeoSot 5541179b38
Fix `Util.reflow` function and add documentation (#34543)
* add documentation to reflow function

* refactor to void as it should be

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-20 17:20:43 +03:00
alpadev 4927388197
Register only one `DOMContentLoaded` event listener in `onDOMContentLoaded` (#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 <xhmikosr@gmail.com>
2021-06-22 20:19:55 +03:00
alpadev 4a5029ea29
Fix handling of transitionend events dispatched by nested elements(#33845)
Fix handling of transitionend events dispatched by nested elements
Properly handle events from nested elements

Change `emulateTransitionEnd` to `executeAfterTransition` &&
2021-06-03 14:44:16 +03:00
alpadev b39b665072
Automatically select an item in the dropdown when using arrow keys (#34052) 2021-05-22 10:58:52 +03:00
Ryan Berliner 4ac711b5b4
Refactor `isVisible` helper, fixing false positives from deep nesting or alternate means (#33960) 2021-05-20 16:50:53 +03:00
GeoSot df72a21fa8
Add `getNextActiveElement` helper function to utils, replacing custom implementation through components (#33608) 2021-05-19 01:23:52 +03:00
GeoSot 6e1c9096f0
Move get element functionality to a helper (#33327)
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-13 18:17:20 +03:00
GeoSot 9fe36edf68
Extract static `DATA_KEY` & `EVENT_KEY` to base-component (#33635)
* Force each plugin that extends base-components to implement a static method `NAME()`
* Remove redundant `NAME` argument from 'Utils.defineJQueryPlugin' & fix test
2021-05-11 10:49:30 +03:00
GeoSot 80085a12f6
Decouple BackDrop from modal (#32439)
* 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 <rohit2sharma95@gmail.com>
2021-04-14 13:28:50 -07:00
Rohit Sharma b2bc159d72 Use cached `noop` function everywhere 2021-04-11 09:42:52 +03:00
GeoSot c5083d5fc3
Use more safe check for 'isDisabled' helper (#33385) 2021-03-17 07:44:15 +02:00
GeoSot ddf72bc612
Accept data-bs-body option in the configuration object as well (#33248)
* Accept data-bs-body option in the configuration object as well

Tweak jqueryInterface, add some more tests

* Fix Markdown table formatting and tweak the wording on backdrop

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-16 18:35:03 +02:00
Florian Vick 2a9d72133d
Prevent `getSelector` from returning URLs as selector (#32586)
* added checks to getSelector in util to prevent returning hrefs that are invalid selectors

* restored compatibility for the class selector and added test cases for keeping urls from being returned as a selector

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:58:54 +02:00
Rohit Sharma c9cd741aff
Throw a `TypeError` instead of the generic `Error` (#32585)
* Change from Error to TypeError

* Convert the `NAME` to upper case to make the consistency in the error message

* Update the remaining tests to be stricter

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 22:13:30 +02:00
alpadev 85208ae557
Refactor components to use a utility function to define jQuery plugins (#32285)
* refactor: use an utility function to define jQuery plugins

* test: add spec for defineJQueryPlugin utility function

* Update .bundlewatch.config.json

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-08 08:16:50 +02:00
Rohit Sharma 418f17ee2b Add `bs` in data attributes
- Add `bs` in data APIs everywhere
- Update unit tests
2020-11-14 07:09:15 +02:00
Sascha c21506d499
Fix TypeError when Bootstrap is included in `head` (#32024)
* extend jquery after domContentLoaded event is fired

* add unittest for util onDOMContentLoaded

* wait for trigger jquery event after domContentLoaded

* remove domcontentready from eventHandler

* move istanbul ignore statements to correct line

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-01 15:32:36 +02:00
Johann-S 26d86fce2a
fix: remove make array util function (#30430) 2020-03-25 16:35:02 +02:00
Johann-S aff115219e
fix: ensure `totype` always returns stringified null/undefined when null/undefined is passed (#30383) 2020-03-18 13:10:55 +02:00
XhmikosR 577bf8b14d
Rename "js/tests/units" to "js/tests/unit". (#29503) 2019-10-09 01:27:43 +03:00