-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: Allow loading nested objects onto existing libraries #45
feat: Allow loading nested objects onto existing libraries #45
Conversation
35fd055
to
8063afd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok. You need to sign the CLA, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TiraO 👍 Thx
test/test.js
Outdated
@@ -20,11 +20,11 @@ describe("loader", function() { | |||
}, "").should.be.eql(HEADER + | |||
// First import | |||
"var abc = (abc || {});\n" + | |||
"abc.def = {};\n" + | |||
"abc.def = abc.def || {};\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put this in a additional test instead of changing the existing one, if this makes no difference and covers the current purpose of the test, feel free to ignore me here :)
test/test.js
Outdated
@@ -9,7 +9,7 @@ describe("loader", function() { | |||
query: "?abc.def.ghi=>1" | |||
}, "").should.be.eql(HEADER + | |||
"var abc = (abc || {});\n" + | |||
"abc.def = {};\n" + | |||
"abc.def = abc.def || {};\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-ciniawsky is correct. This should be two tests, the existing plus an additional test to cover the new nesting functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does seem like there should be a test that is not impacted by this change. That probably means adding a test for the case where there is no nesting, or exec the generated code and test its behavior:
describe("when the import is nested", function(){
it("creates the nested variable", function(){
....
});
describe ("when the import is a plugin to an existing library", function(){
it ("adds the functionality to the library", function (){
expect(some.nested.library.originalProperty).toBeDefined ()
...
That would be a larger refactor to how the tests are structured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my fault for not paying attention when I looked at it originally but as a life rule in JavaScript, don't use eval. Even when it isn't a gigantic gaping security issue, there is always a way to do the same thing without it.
- now tests cover the generated code's behavior instead of testing the literal text of the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TiraO Thx 👍 && very much 💯 for the addtional test updates a lot better now
@TiraO Can you give me a brief usage example for the docs please, I will overhaul the README today before next release |
e.g. loading a jquery plugin jquery.event.drag should not set event.drag to empty object.