diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-05-13 18:17:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 18:17:20 +0300 |
commit | 6e1c9096f08ed21063fd6ba16aa998a3ac4149f9 (patch) | |
tree | f6d0ecf0ebe37529a6b5eb3c262e1d423093b6cc /js/tests/unit/dropdown.spec.js | |
parent | e376142d85e3ce0a5f5e49f3d676e419287a7292 (diff) |
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
Diffstat (limited to 'js/tests/unit/dropdown.spec.js')
-rw-r--r-- | js/tests/unit/dropdown.spec.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js index 7121857841..5275f1a556 100644 --- a/js/tests/unit/dropdown.spec.js +++ b/js/tests/unit/dropdown.spec.js @@ -3,7 +3,7 @@ import EventHandler from '../../src/dom/event-handler' import { noop } from '../../src/util' /** Test helpers */ -import { getFixture, clearFixture, createEvent, jQueryMock } from '../helpers/fixture' +import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture' describe('Dropdown', () => { let fixtureEl @@ -467,6 +467,7 @@ describe('Dropdown', () => { const btnDropdown = fixtureEl.querySelector('[data-bs-toggle="dropdown"]') const virtualElement = { + nodeType: 1, getBoundingClientRect() { return { width: 0, |