-
Notifications
You must be signed in to change notification settings - Fork 189
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
Pass Node ID string to run(). #152
Conversation
@@ -33,6 +33,10 @@ function(EventEmitter, RendererController, AssetController, tools, URI, version) | |||
}, | |||
|
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.
I know this is going to be an inconsistent request, but if you're going to overload the parameters, please add a jsdoc here explaining it. Yes, the function should have had a jsdoc anyways, but for whatever reason it doesn't.
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.
Looking a bit deeper I found the run
method (I’m now assuming createRenderer
is private and therefore not documented). https://github.com/iamdustan/bonsai/blob/cb6ed0f511ea50b0b4510d144b357651bb8ca139/src/bootstrapper/player.js#L90
I moved the method overloading there as it seems to be a better fit (and it’s already jsdoc’d)
Also, while the judges decide on this pull request (full disclosure: i'm not a judge); please also update the changelog and add a pull request for bonsai-docs (referring to this ticket in the PR there, or something, I guess) with an update for this API. |
Sorry for not providing feedback earlier. I’m not too happy with the current state of this PR for the following reasons:
|
@davidaurelio great points. Introducing |
@@ -13,6 +13,16 @@ define([ | |||
return new SvgRenderer(createFakeDomNode(), 1, 1); | |||
} | |||
|
|||
it('should accept a dom id for the node argument', function () { | |||
spyOn(document, 'getElementById').andReturn(createFakeDomNode()); | |||
spyOn(SvgRenderer, 'Svg'); |
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.
So I was hoping that this line would work for the new Svg
line in the SvgRenderer constructor, but it didn’t fly. I got it to work by making the new Svg line say new SvgRenderer.Svg
but then there were other integration issues with L227 svg.root.addEventListener
Any tips?
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.
Hm, I’d just test whether the append()
method of the fake node has been called with the root node of the movie. E.g. like this:
var targetNode = createFakeDomNode();
spyOn(targetNode, 'appendChild');
spyOn(document, 'getElementById').andReturn(targetNode);
var renderer = new SvgRenderer('thing', 1, 1);
expect(document.getElementById).toHaveBeenCalledWith('thing');
expect(targetNode.appendChild.).toHaveBeenCalledWith(renderer.svg.rootContainer);
That should do the trick
Finally updated this with your suggestions @davidaurelio. Let me know what you think. I’m done for the day. No more github spam from me ;) |
Looks good, just finish the last test (I’ve commented on it) and merge current master, then we’re good to go. Thanks for the work |
And fixed. Hope you’re feeling better. Thanks for the tip! |
Just pulled this down and compiled it. It doesn’t work :( Here’s a copy of the compiled code. Hopefully will have a moment this weekend to go further into it than the test did. :/
|
Ok. The player module tries to get the computed width and height of the DOM element (which is a string), because either width or height weren’t passed. Seems we need to resolve an id early. Sorry for being so nit-picky before and delegating id resolution to the svg renderer. |
Do you think that we should resolve at the My concern with adding it to |
Thought this would be an easy one to tackle and start looking into some more of the code.
The tests with
funcSetup
are definitely a lot harder to follow. I had to change the check to a string from an!(node instanceof Node)
since the testscreateMockNode
function returns a simple object.