2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

Js - use a default JQueryInterface in js components

This commit is contained in:
GeoSot
2021-12-02 18:12:53 +02:00
parent 88a6610895
commit dd9f2b31d0
27 changed files with 161 additions and 239 deletions
+8 -7
View File
@@ -3,6 +3,7 @@ import EventHandler from '../../src/dom/event-handler'
import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture'
import { isVisible } from '../../src/util/index'
import ScrollBarHelper from '../../src/util/scrollbar'
import { getJqueryInterfaceForPlugin } from '../../src/util/jquery-stuff'
describe('Offcanvas', () => {
let fixtureEl
@@ -722,7 +723,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
jQueryMock.fn.offcanvas.call(jQueryMock)
@@ -736,7 +737,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
const offCanvas = new Offcanvas(div)
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
jQueryMock.fn.offcanvas.call(jQueryMock)
@@ -750,7 +751,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
expect(() => {
@@ -764,7 +765,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
const action = '_getConfig'
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
expect(() => {
@@ -778,7 +779,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
const action = 'constructor'
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
expect(() => {
@@ -793,7 +794,7 @@ describe('Offcanvas', () => {
spyOn(Offcanvas.prototype, 'show')
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
jQueryMock.fn.offcanvas.call(jQueryMock, 'show')
@@ -805,7 +806,7 @@ describe('Offcanvas', () => {
const div = fixtureEl.querySelector('div')
jQueryMock.fn.offcanvas = Offcanvas.jQueryInterface
jQueryMock.fn.offcanvas = getJqueryInterfaceForPlugin(Offcanvas)
jQueryMock.elements = [div]
jQueryMock.fn.offcanvas.call(jQueryMock, { scroll: true })