aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/util/index.spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/tests/unit/util/index.spec.js b/js/tests/unit/util/index.spec.js
index ecad59b4d..d4b09bf77 100644
--- a/js/tests/unit/util/index.spec.js
+++ b/js/tests/unit/util/index.spec.js
@@ -413,4 +413,29 @@ describe('Util', () => {
expect(spy).toHaveBeenCalled()
})
})
+
+ describe('defineJQueryPlugin', () => {
+ const fakejQuery = { fn: {} }
+
+ beforeEach(() => {
+ Object.defineProperty(window, 'jQuery', {
+ value: fakejQuery,
+ writable: true
+ })
+ })
+
+ afterEach(() => {
+ window.jQuery = undefined
+ })
+
+ it('should define a plugin on the jQuery instance', () => {
+ const pluginMock = function () {}
+ pluginMock.jQueryInterface = function () {}
+
+ Util.defineJQueryPlugin('test', pluginMock)
+ expect(fakejQuery.fn.test).toBe(pluginMock.jQueryInterface)
+ expect(fakejQuery.fn.test.Constructor).toBe(pluginMock)
+ expect(typeof fakejQuery.fn.test.noConflict).toEqual('function')
+ })
+ })
})