Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If AMD is available, install the plugin #27

Open
wvl opened this issue Jan 7, 2013 · 0 comments
Open

If AMD is available, install the plugin #27

wvl opened this issue Jan 7, 2013 · 0 comments

Comments

@wvl
Copy link

wvl commented Jan 7, 2013

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant