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

module parameter for QUnit.reset() usage #333

Closed
wants to merge 1 commit into from
Closed

module parameter for QUnit.reset() usage #333

wants to merge 1 commit into from

Conversation

bennom
Copy link

@bennom bennom commented Oct 19, 2012

With these changes it's possible to define a (boolean) parameter for module() - resetFixture:

If set to true: QUnit.reset() will be skipped for the module.
If not set / set to false: QUnit.reset() will be performed as usual.

With these changes it's possible to define a (boolean) parameter for module() - resetFixture:

If set to true: QUnit.reset() will be skipped for the module.
If not set / set to false: QUnit.reset() will be performed as usual.
@jzaefferer
Copy link
Member

What issue are you addressing here? In what case wouldn't you want to address the fixture?

@bennom
Copy link
Author

bennom commented Oct 21, 2012

One of the main principles of unit testing is "keep the tests atomic". With this in mind, I'm trying to test my jQuery plugin. 1st test: initialization (with html replacements), 2nd test: some user interactions based on the elements inserted by test #1 (new DOM elements will appear again) and so on. But between each test the DOM elements inserted by the plugin will be reset (but I need them to apply more tests). So I think sometimes it's necessary to keep the content within the fixture :-)

@jzaefferer
Copy link
Member

"keep tests atomic", right, that's exactly why this is really wrong. You should put shared init code into module-setup, not sure fixture. Otherwise your second test breaks when you run it standalone, e.g. using the Rerun link.

@jzaefferer jzaefferer closed this Oct 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants