Commit Graph

31 Commits

Author SHA1 Message Date
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
Julien Déramond f44feabe16
Tests: remove unnecessary `id`/`aria-labelledby` from collapse unit tests (#38089) 2023-02-21 19:33:52 +01:00
Patrick H. Lauke 0446e22b5a
Docs: use `<button>` for dropdown/popover examples, explain preference over `<a>` for dropdowns, tweak collapse prose (#37432)
* Expand dropdown explanation for use of `<a>`, use `<button>`s for modal examples

* Remove redundant `role="button"` from collapse test `<button>` elements

* Tweak language

* Tweak collapse prose
2022-11-12 09:21:33 -08:00
XhmikosR 5208dd10c4
ESLint: enable prefer-template rule (#37484) 2022-11-12 10:09:36 +02:00
Pierre Souchay ef4e2daa48
Properly escape IDs in getSelector() to handle weird IDs (#35565) (#35566) 2022-11-07 14:43:06 +02: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 4b17868fb4
tests: revisit all tests using Promise.reject instead of throwing an error (#35765) 2022-02-19 16:08:16 +02: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
Louis-Maxime Piton d8999dd566
Tests: Minor fixes (#35455) 2021-12-02 12:01:11 +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 bdfb4cc54d
Fix Collapse regression of handling toggling between sibling chilldren (#34951) 2021-09-15 15:33:19 +03:00
XhmikosR c5d03d93fc
Rename `e` to `event` (#34979) 2021-09-15 14:27:46 +03:00
GeoSot c9af4565fd
tests: fix lint warning (#34950) 2021-09-13 10:57:17 +03:00
GeoSot c1fc1dbbee
Collapse on toggle, should not hide descendant tabpanels (#34835) 2021-08-30 15:29:02 +03:00
GeoSot 6f17e634ce keep parent only as element 2021-07-29 16:30:02 +03:00
Mark Otto 359ed099e5 Add horizontal collapse support 2021-07-05 17:22:29 -10:00
GeoSot c98657b830
Add `getOrCreateInstance` method in base-component (#33276)
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-03 18:53:27 +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
Ben Lertlumprasertkul 052def4568
Remove potential false positive assertions (#33288)
* Remove potential false positive assertions

querySelector() returns null but

expect(document.querySelector('...')).toBeDefined()

tests that the value is not undefined

* Migrated assertions from .toBeDefined() to .not.toBeNull() for .getInstance() calls in tests

* Migrate offcanvas assertions from .toBeDefined() to .not.toBeNull() for .getInstance() call

* convert more cases to not.toBeNull assertions

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-05-11 08:45:57 +03:00
Rohit Sharma dc5e3328c1
Allow constructors to accept a CSS selector (#32245)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <otto@github.com>
2021-02-22 09:01:04 +02:00
GeoSot 3602828a90
Add tests for `DATA_KEY` (#33090)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-16 08:58:08 +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
Daniele Faraglia 59cd71631e
collapse: prevent url change if `A` nested tag is clicked (#32438)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:37:35 +02:00
XhmikosR 51a208f119 Switch to Jasmine's `toBeInstanceOf` matcher 2020-11-29 20:58:26 +02:00
Johann-S 9f6b342dc7 create a base component 2020-11-29 20:58:26 +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
XhmikosR 967e6071ba
tests: streamline HTML end tags (#30648) 2020-05-06 09:20:08 +03:00
Johann-S 26d86fce2a
fix: remove make array util function (#30430) 2020-03-25 16:35:02 +02:00
XhmikosR 577bf8b14d
Rename "js/tests/units" to "js/tests/unit". (#29503) 2019-10-09 01:27:43 +03:00