Skip to content

If AMD is available, install the plugin #27

@wvl

Description

@wvl

If we're in an AMD environment, wouldn't it make sense to just install the plugin rather than return it? In other words, is there a use case where we require 'chai-jquery' but don't want it installed by default?

I would have expected this:

diff --git a/chai-jquery.js b/chai-jquery.js
index f29f2b1..aa8f693 100644
--- a/chai-jquery.js
+++ b/chai-jquery.js
@@ -5,10 +5,10 @@
     module.exports = chaiJquery;
   } else if (typeof define === "function" && define.amd) {
     // AMD
-    define(['jquery'], function ($) {
-      return function (chai, utils) {
+    define(['jquery','chai'], function ($,chai) {
+      chai.use(function (chai, utils) {
         return chaiJquery(chai, utils, $);
-      };
+      });
     });
   } else {
     // Other environment (usually <script> tag): plug in to global chai instanc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions