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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added an example to the README #52
Conversation
document.body.appendChild(newDiv) | ||
|
||
// Find the element by id on the page, and compare the contents | ||
assertEquals(document.getElementById(id).innerHTML, content) |
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.
Does MUnit reverse the meaning of the arguments to assertEquals
? Normally the expected value is on the left, and the actual value on the right.
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.
Did not know that. I've always treated it like a predicate e.g. if index == 0
.
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.
However, I think it does flip them:
test("assert") {
assertEquals(1, 2)
}
gives
values are not the same
=> Obtained
1
=> Diff (- obtained, + expected)
-1
+2
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.
OK, then let's keep it as is.
LGTM. Could you squash everything in a single commit with a clean commit message, please? |
The purpose of adding this example is to demystify the plugins usage, hopefully making it easier for people to get started.
56b32bf
to
fc0ef72
Compare
Done, hopefully that's better. Sorry I was a bit hasty with the first version of the PR. |
I found the instructions a bit magical, so I thought I'd spell out the usage a bit for the next person interested in trying it.
Based on the jsdom docs I had it in my head that I was was going to have to create a jsdom instance myself. "Is this plugin giving me a nice way to do that?" I wondered ...but after I read the source code I realised that this plugin is fully setting up node.js with a running dom instance (of course... makes much more sense 馃う ).
Anyway I hope this helps someone.